My program is supposed to reverse the string inputted, print it then extract the numbers and print the numbers of the reversed string in a list.
Code:
def reverse_str(string):
revstring =('')
length=len(string)
i = length - 1
while i>=0:
revstring = revstring + string[i]
i = i - 1
return revstring
def strip_digits(string):
result = []
for c in string:
result = result + c
string = raw_input("Enter a string->")
new_str = reverse_str(string)
print new_str
numberless_str = strip_digits(string)
Comment