How about -
print "\n\nWelcome to the Backwards Message Display."
print
message = raw_input("\nPlease Enter a Message.")
msgAsList = [ char for char in message]
msgAsList.reverse()
reversedMessage = ''.join(msgAsList)

I can't test that, but it should work.

But, with regard to - 

> 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")

low will always be the first char of the string, won't it? In which case,
It'd always be 0. or len(message) - len(message) !

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Ed Singleton
Sent: Friday, 18 November 2005 6:11 a.m.
To: tutor@python.org
Subject: Re: [Tutor] Newb ?


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

A new monthly electronic newsletter covering all aspects of MED's work is now 
available.  Subscribers can choose to receive news from any or all of seven 
categories, free of charge: Growth and Innovation, Strategic Directions, Energy 
and Resources, Business News, ICT, Consumer Issues and Tourism.  See 
http://news.business.govt.nz for more details.




http://www.govt.nz - connecting you to New Zealand central & local government 
services

Any opinions expressed in this message are not necessarily those of the 
Ministry of Economic Development. This message and any files transmitted with 
it are confidential and solely for the use of the intended recipient. If you 
are not the intended recipient or the person responsible for delivery to the 
intended recipient, be advised that you have received this message in error and 
that any use is strictly prohibited. Please contact the sender and delete the 
message and any attachment from your computer.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to