Countdown

Remco Gerlich scarblac-spamtrap at pino.selwerd.nl
Sun Jun 25 10:32:36 EDT 2000


Jeff Sandys wrote in comp.lang.python:
> Python is really elegant when counting up:
> 
> for i in range(len(thing)):
>     print thing[i]
> 
> But when counting down looks ugly:
> 
> for j in range(len(thing)-1,-1,-1):
>     print thing[i]


for i in range(len(thing)):
   print thing[-i]


-- 
Remco Gerlich,  scarblac at pino.selwerd.nl
  Murphy's Rules, "Life in the fast lane":
   In the fifth edition of FBI's Tunnels & Trolls, an average man may
   make 10-second sprints topping 60 miles per hour. An exceptional
   runner could sprint at 118 mph.



More information about the Python-list mailing list