+2 votes
in Programming Languages by (71.8k points)
edited by
The reverse() function of Python is applicable only for the list. How can I reverse a string?

1 Answer

+1 vote
by (71.8k points)
selected by
Best answer

There are several ways to reverse a string in Python, but one of the easiest and quickest ways is using extended slicing.

>>> a="hello"
>>> a[::-1]


Related questions