Concantenation and string slicing

Larry Bates larry.bates at websafe.com
Sat Feb 25 16:32:28 EST 2006


Dennis Lee Bieber wrote:
> On Thu, 23 Feb 2006 18:06:46 -0600, Larry Bates
> <larry.bates at websafe.com> declaimed the following in comp.lang.python:
> 
> 
>> Better was is:
>>
>> message = raw_input("Enter a message:  ")
>> print message[::-1]
>>
> 
> 	I sometimes get the feeling a lot of responses to newbies, lately,
> fail to explain what was wrong in the original code in favor of showing
> off the tricks that Python is capable of...

Several others had already pointed out what was wrong (which
of course the OP would have know if he had done a tutorial).
I merely wanted to post a solution that IMHO was a much
better way to accomplish the task.  The OP is free to choose
among the posted solutions.  If others had not yet posted the
solution, I would have posted both.

-Larry Bates



More information about the Python-list mailing list