# Define a list
numbers = [4, 4, 5, 9, 4, 3, 6, 9]
# Get the frequency of 4
result = numbers.count(4)
# Print the result
print(result)
Output
3
In the code snippet
As we have already explained the functionality of List.count() function in Python. The count() function returns the count of a specific item in the list.
Syntax
List.count(item)
Code Example
my_list = ['a', 'b', 'a', 'c', 'd', 'a', 'a']
result = my_list.count('a')
print(result)
Output
4
0 Comments