Do me a favor, take a few seconds to have a look at my last project.

Thank you, Lulu

Count list elements in Python

Count elements in list

>>> myList=[8, 2, 3, 6, 8]
>>> len(myList)
5

Count the occurrences of a given item in the list

>>> myList=["a","a","a","b","c","c"]
>>> myList.count('a')
3

Test if a given value is in the list

>>> myList=[10,20,30,40,50]
>>> 25 in myList
False

See also


Last update : 04/15/2019