These both work (though neither is very graceful).

text = "hello"
message = ""

for i in range(len(text)):
       message = message + text[(len(text)-i-1)]

print message


lst = list(text)
newstr = ""

for item in text:
       newstr += (lst.pop())

print newstr

On 16/11/05, Chad Everett <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> Have a problem here with a challenge from a book I am reading.
> Any help is much appreciated.
>
> I am trying to run a program that asks the user for a statement and then
> prints it out backwards.
> this is what I have.
> It does not print anything out.  I assume that I have something out of whack
> with my high and low statements.
>
> Thanks for you help.
>
>
> print "\n\nWelcome to the Backwards Message Display."
> print
> message = raw_input("\nPlease Enter a Message.")
>
> high = len(message)
> low = -len(message)
> print
> print message[high:low]
> print
> print raw_input("Please Press Enter to Exit")
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to