Python List Length
List Length
To determine how many items a list has, use the
len()
function:
Example
Print the number of items in the list:
thislist = ["apple", "banana", "cherry"]
print(len(thislist))
Try it Yourself »
To determine how many items a list has, use the
len()
function:
Print the number of items in the list:
thislist = ["apple", "banana", "cherry"]
print(len(thislist))
Try it Yourself »
If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]
If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]