Python Program to Count the Occurrence of an Item in a List

To understand this example, you should have the knowledge of the following Python programming topics:

Using count() method

freq = ['a', 1, 'a', 4, 3, 2, 'a'].count('a')



Using count() method, pass the item to be counted. As shown above, 'a' is passed, which gives the total number of occurrences of character 'a'.

You can learn more about count() at Python count().

Did you find this article helpful?