Counting the occurrences of one item in a sequence list.count and tuple.count

suggest change
alist = [1, 2, 3, 4, 1, 2, 1, 3, 4]
alist.count(1)
# Out: 3

atuple = ('bear', 'weasel', 'bear', 'frog')
atuple.count('bear')
# Out: 2
atuple.count('fox')
# Out: 0

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents