[Tutor] (no subject)

Alan Gauld alan.gauld at btinternet.com
Wed Sep 9 08:34:19 CEST 2009


"Christian Witts" <cwitts at compuscan.co.za> wrote 

>>
>> What about range(0, -n, -1) ?
>>
> That would need to have a starting value of -1 and an end value of 
> -(len(phrase)+1).  Of else you can start at length - 1, end at zero and 
> a step value of -1.

Another option, using "normal" range values but negative indexing is 

for i in range(1,len(word)+1):
      print word[-i],

Alan G



More information about the Tutor mailing list