# string reverse done recursively # ECS 10, May 26, 2009 # Matt Bishop # function to reverse string # parameter: s, a string # returns: s reversed def revstr(s): # base case: string with 0 elements if s == "": return "" # recursion here else: return revstr(s[1:]) + s[0]