Confused: appending to a list

Fredrik Lundh fredrik at pythonware.com
Thu Mar 23 12:25:31 EST 2006


"DataSmash" wrote:

> I'm confused.  Why is it that when I say "while len(list) < 5:", I get
> 5 items in my list.
> If I say "while len(list) < 6:", I get 6 items in the list and so on.
> I would think if I said "less than 5", I would get 4 items.

except that you're saying "as long as there are less than 5 items
in the list, add another one"

</F>






More information about the Python-list mailing list