I have a list that contains the name, age, and id of a person respectively. I want to count the number of occurrences of a given id within the list.
When I try:
alist=[(('john', 37), 8),(('john', 37), 8)]
count_ID=alist.count(8)
print count_ID
I receive:
count_ID returns 0
I expect it to return 2 in this example, as the list has 2 items that have id=8. How can I fix this?