Countdown

Will Ware wware at world.std.com
Sun Jun 25 16:26:26 EDT 2000


Remco Gerlich (scarblac-spamtrap at pino.selwerd.nl) wrote:
> for i in range(len(thing)):
>    print thing[-i]

If thing = [1, 2, 3, 4, 5], then this piece of code will print
1, 5, 4, 3, 2. The code below has probably the less surprising
effect of printing 5, 4, 3, 2, 1.

for i in range(len(thing)):
    print thing[-i-1]
-- 
 - - - - - - - - - - - - - - - - - - - - - - - -
Resistance is futile. Capacitance is efficacious.
Will Ware	email:    wware @ world.std.com



More information about the Python-list mailing list