Home >>Python List Methods >Python List count() Method

Python List count() Method

Python List count() Method

Python list count() method is used to return the number of element present in the given input list with the specified value.

Syntax:
list.count(value)

Parameter Values

Parameter Description
value This is a required parameter. It defines the value to search for.
Here is an example of Python count() method:

fruits = ["Abhi", "Alpha", "Jerry"]
x = fruits.count("Jerry")
print(x)

Output:
1
Example 2:

fruits = [1, 4, 2, 9, 8, 5, 4, 7, 8, 7, 8, 9, 3, 1, 8]
x = fruits.count(8)
print(x)

Output:
4

No Sidebar ads