In the above Python program to calculate the number of occurrence of an element in an array, we have used buil-in function count() which will count the elemet passed inside it in the given array.
from array import *
arr_num = array('i', [2, 6, 4, 7, 9, 6, 12, 6, 2, 1])
print("Original array: "+str(arr_num))
print("Number of occurrences of the number 6 in the said array: "+str(arr_num.count(6)))
Sample Output: Original array: array('i', [2, 6, 4, 7, 9, 6, 12, 6, 2, 1]) Number of occurrences of the number 6 in the said array: 3