programming-examples/python/Function/Python program to reverse a string.py
2019-11-15 12:59:38 +01:00

9 lines
222 B
Python

def string_reverse(str1):
rstr1 = ''
index = len(str1)
while index > 0:
rstr1 += str1[ index - 1 ]
index = index - 1
return rstr1
print(string_reverse('1234abcd'))