[Tutor] how to print a message backwards

Lie Ryan lie.1296 at gmail.com
Fri Sep 25 16:01:37 CEST 2009


Emile van Sebille wrote:
> 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.
> 

<nitpick>
reversed built-in *function*, not *keyword*
</nitpick>



More information about the Tutor mailing list