In this example, you will learn to count the occurrence of an item in a list.
Using count() method
freq = ['a', 1, 'a', 4, 3, 2, 'a'].count('a')
print(freq)
Output
3
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().