What is the result of "Python"[::-1] in Python?
-
A
"Python"
-
B
"nohtyP"
Correct answer
-
C
"nohtyP"
-
D
"ythoPn"
Correct answer
B. "nohtyP"
17 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