# reverse.py # Neal 2009.10.15 # # Reverse a string using the accumulator design pattern def reverse(s): rs = "" # Start accumulator with the empty string as the reverse string for c in s: rs = c + rs # concat new character on the beginning of the accumulator return rs # return the reverse string def main(): name = raw_input("Give me a name: ") revname = reverse(name) print revname main()