What is the output of print('Python'[-1]) in Python?
print('Python'[-1])
Correct answer
D. n
5 views
D. n
5 views
Index -1 refers to the last character.
Asked in: Python Interview Strings
https://docs.python.org/3/library/stdtypes.html#string-methodsNot sure why the answer is D? Ask here and get an explanation.