Countdown
Aahz Maruch
aahz at netcom.com
Sun Jun 25 19:27:39 EDT 2000
In article <Fwq8s2.A8z at world.std.com>, Will Ware <wware at world.std.com> wrote:
>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]
I'd make that
print thing[-(i+1)]
for clarity.
--
--- Aahz (Copyright 2000 by aahz at netcom.com)
Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6
The best way to get information on Usenet is not to ask a question,
but to post the wrong information. --Aahz
More information about the Python-list
mailing list