programming-examples/python/Function/Python program to reverse a string.py

9 lines
222 B
Python
Raw Normal View History

2019-11-15 12:59:38 +01:00
def string_reverse(str1):
rstr1 = ''
index = len(str1)
while index > 0:
rstr1 += str1[ index - 1 ]
index = index - 1
return rstr1
print(string_reverse('1234abcd'))