What is the output of "python"[::-1] in Python?
-
A
"python"
-
B
"nohtyp"
Correct answer
-
C
"nythop"
-
D
Error
Correct answer
B. "nohtyp"
15 views
Explanation
Slicing with [::-1] reverses the string, so "python"[::-1] results in "nohtyp".
Doubts & discussion
Not sure why the answer is B? Ask here and get an explanation.
Ask a doubt about this MCQ