182,064 views
6 votes
6 votes
array Write a recursive function stringReverse that takes a string and a starting subscript as arguments, prints the string backward and returns nothing. The function should stop processing and return when the end of the string is encountered. Note that like an array, the square brackets ( [ ] ) operator can be used to iterate through the characters in a string.

User Bgschiller
by
3.1k points

1 Answer

7 votes
7 votes

user_in = str ( input ("Please enter a phrase: " ))

def reverse_str (string):

e = 0

for e in range (len (string)):

x = -1

print string[x]

x += (len (string))

User Maximiliano Padulo
by
2.8k points