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.")
print i[::-1]
raw_input("\n\nPress the enter key to exit.")
Thanks for allowing me to take some of your precious time.
Jim
----- Original Message -----
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?
Hi Jim,
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:
http://www.python.org/2.4/
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?
|
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor