[::1], but the input string does not reverse itself | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

[::1], but the input string does not reverse itself

#your code goes here say = [input()] print(say[::-1]) the input string does not reverse itself

16th May 2021, 1:13 PM
Lee 4 Code
Lee 4 Code - avatar
4 Answers
+ 4
no [] needed
16th May 2021, 1:26 PM
Lee 4 Code
Lee 4 Code - avatar
+ 4
Lee For Code Just store the user input in a string variable then use [::-1] on that variable. No need to use [input()]
16th May 2021, 1:28 PM
TOLUENE
TOLUENE - avatar
+ 4
print(input()[::-1])
16th May 2021, 2:07 PM
David Ashton
David Ashton - avatar
+ 3
because say is a list of 1value. say[::-1] reverses say list not say[0]. To reverse string you may use say[0][::-1]. or say = input()
16th May 2021, 1:20 PM
TOLUENE
TOLUENE - avatar