Python List | count method
Start your free 7-days trial now!
List.count(~) method returns the number times a given item occurs in a list.
The element to check count for.
Returns the number of occurrences of the element in the list.
The below code checks how may times 4 appears in numbers. We see the return value of 3 as 4 appears three times in numbers.
numbers = [1,2,3,4,4,4,5,6]numbers.count(4)3