[Tutor] Python backwards program (fwd)
Jim and Laura Ahl
jcahl at psci.net
Fri Apr 15 06:09:01 CEST 2005
Hello, I wanted to thank all of you who helped me with the backwards program. I finally got off my stubborn butt and downloaded 2.4.1 and the program finally works. That 2.2 was not compatible with the way I was thinking, or maybe I wasn't compatible with it was thinking who knows.
i = raw_input("Enter a word.")
raw_input("\n\nPress the enter key to exit.")
Thanks for allowing me to take some of your precious time.
----- Original Message -----
From: Danny Yoo
To: jcahl at psci.net
Sent: Thursday, April 14, 2005 1:52 PM
Subject: Re: [Tutor] Python backwards program (fwd)
> Does the 2.2 python have the ability to do this?
Python 2.2 is actually a bit old; you may want to update the version of
Python on your system to Python 2.4. You can find it here:
A lot of the approaches you were trying earlier used features that were
added in the 2.3 or 2.4 Python series; they're absent from Python 2.2.
> The following gives me the last letter of the string.
> backwords=raw_input("enter number or string:")
> print backwords[-1]
Yes, this is an interesting approach! We can go along this approach a
little more, if you'd like. The code above is getting the last letter, so
we're closer to printing out the word backwards.
How would you print out the second to last letter of the string?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor