In Python you can use the list method .count() to count the number of matching elements in the list.
Example:
print([1, 2, 3, 4, 1, 4, 1].count(1))
print(["ab","ab","bc","de"].count("ab"))
print([1,1,2.1,"b"].count(1))
The output is as follows:
3
2
2