[Tutor] how to print a message backwards

Emile van Sebille emile at fenx.com
Wed Sep 23 22:57:19 CEST 2009


On 9/23/2009 7:22 AM Ali Sina said...
> #Message backward printer
> message=input('Enter your message: ')
> 
> for i in range(len(message),0,-1):
>     print(message)
> 
> 
> This is the code which I have written. All it does is count the number of letters starting from backwards. The proper code should so something like this:
> 
> Enter your message: Hi. My name is Ali Sina
> 
> Your message in backwards: aniS ilA si eman yM .iH


There's also a reversed keyword introduced in python 2.4.

Emile




> 
> 
>       
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list