0

How to reverse a string in python?

Say I have word="Python" and I say word.reverse(). Then it gives me an error saying reverse can't be used for type str. But aren't strings like lists too?

23rd Jun 2018, 6:17 AM
Futurefic
Futurefic - avatar
1 Answer
+ 4
print(word[::-1])
23rd Jun 2018, 11:35 AM
æŽç«‹ćš