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 range(len(names)): 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 appreciated. By the way this is a great book well worth the investment to anyone's library who is trying to learn Python.
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor