Confused: appending to a list
skip at pobox.com
skip at pobox.com
Thu Mar 23 11:51:57 EST 2006
R.D.> I'm confused. Why is it that when I say "while len(list) < 5:", I
R.D.> get 5 items in my list. If I say "while len(list) < 6:", I get 6
R.D.> items in the list and so on. I would think if I said "less than
R.D.> 5", I would get 4 items. Can anyone explain this? Thanks. R.D.
The loop exits when the condition becomes false. That happens when
len(list) >= 5 (or 6).
Skip
More information about the Python-list
mailing list