[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
- Previous message: [Tutor] Re: algorithm?
- Next message: [Tutor] Hmm...I should be able to figure this out...but...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: [Tutor] Re: algorithm?
- Next message: [Tutor] Hmm...I should be able to figure this out...but...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]