+ 2
Hello, please how do I reverse a string in python?
3 Réponses
+ 9
Apart from using a slice [::-1], there are also some other variants.
inp = 'sololearn
# comprehension:
print(''.join([i for i in reversed(inp)]))
# reversed:
print(''.join(list(reversed(inp))))
+ 5
Black , you can do it this way for example.
https://code.sololearn.com/cDT44q7Gn8MK/?ref=app
0
str = input()
rev = str[::-1]
print(rev)
It works.