How to count the occurrences of specific element in array with Python

1 Answer

0 votes
from array import array
 
arr = array("i", [3, 8, 5, 3, 3, 7, 12, 13, 3])
 
print(arr.count(3))
 
  
  
  
'''
run:

4
   
'''

 



answered Aug 28, 2020 by avibootz
...