Python List count()

In this tutorial, we will see about Python List‘s count method.Python List count method is used to count a number of instances of the element in the list.

Python List count example

You can simply use count method to find number of occurrences of element in the list.
Let’s understand this with the help of simple example.

Output:

Count of 1 in the list1: 3
Count of 2 in the list1: 5
Count of 3 in the list1: 3
Count of 4 in the list1: 2

You can also find count of set or tuple too.Let’s see with the help of example.

Output:

Count of set {1,2}: 2
Count of tuple (3,4) : 3

That’s all about Python List count method.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe to our newletter

Get quality tutorials to your inbox. Subscribe now.