What is the syntax to return how many times a value occurs in a list?

<list name>.count(<search value>)
#examples
>>> grades=[77,64,78,56,99,87,77]
>>> fruits=['apple','cherry','strawberry','cherry']

>>> grades.count(77)
2

>>> grades.count(100)
0

>>> fruits.count('apple')
1

 

Advertisements