+2 votes
in Programming Languages by (10.5k 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 (10.5k 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]
'olleh'
>>> 

 

Related questions

...