Python – Count the number of items in a list

In Python, we can use len() to count the number of items in a List


list = ["a", "b", "c"]

print(len(list))

Output


3

References

  1. Pyhton docs – len()
author image

mkyong

Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities. Read all published posts by

Comments

avatar