Question DSA-STR-0001
EasyWhat is the output of this code?
s = "hello"
print(s[::-1])
- A.
olleh
- B.
o
- C.
Show answer and explanation
Answer: A
Slicing with step −1 reverses the string.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Strings question
What is the output of this code?
s = "hello"
print(s[::-1])
olleh
o
Answer: A
Slicing with step −1 reverses the string.
h
hello