Python Principles
Python Q&A

How do I count how many times a list item occurs?

Answer:

Use the count method of lists. Here is an example:

numbers = [1, 2, 1, 1, 2]
print(numbers.count(0))
print(numbers.count(1))
print(numbers.count(2))

This will print:

0
3
2

Because the number 0 occurs zero times in the list, while the number 1 occurs three times.