Python Tutorial Python Advanced Python Resources Python Libraries
Python Java C++ C C# PHP R SQL DS Algo InterviewQ

Python - List count() Method



The Python list count() method is used to find out the total number of occurrences of a specified element in the list.

Syntax

list.count(elem)

Parameters

elem Required. value of the element which need to be counted in the list.

Return Value

Returns the total number of occurrences of a specified element in the list.

Example:

In the example below, list count() method is used to find out the total number of occurrences of 50 in the list called MyList.

MyList = [10, 50, 50, 100, 50, 1000]

x = MyList.count(50)      
print(x)

The output of the above code will be:

3

❮ Python List Methods

5