Advertisements
Advertisements
Question
Which of the following is the output of the following python code?
str1="TamilNadu"
print(str1[::-1])
Options
Tamilnadu
Tmlau
udanlimaT
udaNlimaT
MCQ
Solution
udanlimaT
Explaantion:
The slicing str1[::-1]
reverses the string "TamilNadu"
to "udanlimaT"
.
shaalaa.com
Introduction to Strings
Is there an error in this question or solution?