How to reverse a string in python

Method 1:

To reverse a string in python, we can do like this:

>>> s='123456'
>>> s=s[::-1]
>>> s
'654321'

Method 2:

We also can use for in to reverse a string in python

>>> s='123456'
>>> str=''
>>> for t in s:
	str=t+str

	
>>> str
'654321'