Newb ?

Scott David Daniels scott.daniels at acm.org
Tue Nov 15 23:36:50 EST 2005


Chad Everett wrote:
> "Paul Watson" <pwatson at redlinepy.com> wrote in message 
> news:3tvpqaFv0q48U1 at individual.net...
> 
>>Chad Everett wrote:
>>>high = len(message)
>>>low = -len(message)
>>>print
>>>print message[high:low]
>>>print
>>>print raw_input("Please Press Enter to Exit")
>>
>>Are you sure that this is not a class assignment?  You can search the 
>>messages here for the answer.
> 
> 
> No,  I have been out of school way too long.  I am 34 trying to learn a new 
> trade.  I searched the group for the term backwards but I did not get any 
> results. 

The problem is that negative numbers mean "count from the rightmost end
of the string or list."  Also, you are going high to low without any
indication that you mean to go backwards.

 >>> message = raw_input("Enter a Message:")
 >>> print message[: : -1]

-Scott David Daniels
scott.daniels at acm.org



More information about the Python-list mailing list