Counting the number of elements in a list - help.
Steingrim Dovland
steingrd at ifi.uio.no
Tue Apr 16 15:54:22 EDT 2002
"Bryce C. Mason" <bmason at rand.org> writes:
> 1) a function which returns the number of elements in a list
> 2) a function which takes a list and an index and returns a zero when that
> list index is out of range.
I think you're looking for len(), a built in function.
>>> x = [1,2,3]
>>> len(x)
3
--
Here the sea spray give
I was with her
We're under the ship so get me over
More information about the Python-list
mailing list