Liam said:
>
> How about -
> print "\n\nWelcome to the Backwards Message Display."
> print
> message = raw_input("\nPlease Enter a Message.")
> msgAsList = [ char for char in message]
You could also do:
msgAsList = list(message)
list() takes any iterable and returns a list object.
> msgAsList.reverse()
> reversedMessage = ''.join(msgAsList)
In Python 2.4, the following is also possible:
reversedMessage = ''.join(reversed(list(message)))
It's amazing how in Python even one-liners can be so pretty :-)
Christian
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor