For example, list[1, 2, 3] has 3 items (and indexex 0, 1, 2).
How can I print the number of objects in a list? In this istance, it would be "3".
For example, list[1, 2, 3] has 3 items (and indexex 0, 1, 2).
How can I print the number of objects in a list? In this istance, it would be "3".
use len
:
>> lst = [0,1,2,3]
>> len(lst)
4
Note : never use list
as a variable name.