[Tutor] Hmm...I should be able to figure this out...but... (original) (raw)

Dick Moores rdm at rcblue.com
Wed Jul 21 12:52:09 CEST 2004


Dragonfirebane at aol.com wrote at 13:54 7/20/2004:

try (untested):

# Initialize Variables string = "" stringlength = 0 rstring = [] # Begin Program string = rawinput("Enter a string and I will display it backwards.\n") stringlength = len(string) for i in range (stringlength, 0, -1): rstring.append(string[i - 1]) print ''.join(rstring), print "\n" rawinput("\nPress the enter key to exit")

This works fine if the loop and print are:

for i in range (stringlength, 0, -1): rstring.append(string[i - 1])

print ''.join(rstring)

Sorry for what is surely a dumb question, but what is the ". in print ''.join(rstring). Can't find this anywhere in the Python docs.

Thanks,

Dick Moores



More information about the Tutor mailing list