Python program to reverse a string (Simple Ways)
In this you will learn, How to write python program to reverse a string.
In this first example, we will reversed function to reverse string.
Example Program 1:
string="online tutorials"
print(''.join(reversed(string)))
Output:
Here we will use lists with reverse function.
Example Program 2:
string = "online tutorials"
rev=list(reversed(string))
print(rev)
Output: