In this tutorial, we are going to learn the Python List count() method. list count function in python allows us to find the count of an item, how many numbers of times appear in the list. Sometimes we need to find how many times items appear in this list.
In the previous tutorial, we have seen the Python list copy() method to create a copy of the existing.
List count() Method:
In Python, the list count() method is a built-in list method, which returns the count of the total number of times an item appears in the list.
Syntax of list count() method:
Python List count() method parameter:
list count method takes a single parameter, That is item.
item:- Required. Any type ( string, number, list, tuple, etc). The value to search for.
Python List count() method example:
fruits = ['apple', 'banana', 'cherry','banana'] x = fruits.count('banana')
In this tutorial, you have learned the python list count() method. Using the list count function, you can count how many times a specific item occurs in the list.
I hope this article will help you. if you like this article please comment and share it with your friends who want to learn Python from scratch to advanced.
For More Reference:- Click Here