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

1 Answer

0 votes
by (15.3k points)
edited by

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