The python strings are characters enclosed in single, double and triple quotes. Python strings are immutable. Strings are sequence of characters, where each character has a unique position id/index.
There is no inbuilt method to reverse a string. But strings can be reversed in several ways.
Here we’ll see reversing a string in python by using for loop.
def reverse(text): text="".join(reversed(text)) return text a="Pythonpoint" print(reverse(a))
def reversestring(text): t="" for i in text: t=i+t return t text="python" print(reversestring(text))
This is all about reversing string by using for loop.