[Tutor] need futher explaining
dale.pearl at gmail.com
Mon Aug 6 09:13:05 CEST 2007
I'm reading Beginning Python - From Novice to Professional by Magnus Lie
Hetland (an Apress book) and there is a code example that I need further
explaining on to fully grasp.
There is a section with samle code of:
names = ['anne', 'beth', 'george', 'damon']
ages = [12, 45, 32, 102]
for i in range(len(names)):
print names[i], 'is', ages[i], 'years old'
now all of it makes sense to me except for the line for i in
the len statement calculates the number of characters I'm not quite
understanding the magic here.
forgive my stupidity this programming stuff is new to me but if someone
could explain to me how this single line works it would be greatly
By the way this is a great book well worth the investment to anyone's
library who is trying to learn Python.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor