how to reverse a string in python using for loop code example

Example 1: python reverse string

'String'[::-1] #-> 'gnirtS'

Example 2: how to reverse a string in python

belief = "the world is mine, hello"[::-1]
print(belief)

Example 3: python iterate through string in reverse

for c in reversed(string):
     print c

Example 4: print string in reverse order uing for loop python

# reversing a sring using recursion
def reverse_recursion(s):
    if len(s) == 0:
        return s
    else:
        return reverse_recursion(s[1:]) + s[0]