mylist = [5, 12, 27, 3, 12, 5, 9, 5, 11] print(mylist.count(3)) # Need print() print(mylist)
Output:1
[5, 12, 27, 3, 12, 5, 9, 5, 11]
mylist = [5, 12, 27, 3, 12, 5, 9, 5, 11] count_number = 5 result = mylist.count(count_number) print(f'There where {result} occurrences of <{count_number}> in:\n{mylist}')
Output:There where 3 occurrences of <5> in:
[5, 12, 27, 3, 12, 5, 9, 5, 11]