7. Write a python program to check the quantity of occurrences of a specified values in the array_a as provided in the following output.
The output is:
array_a = array('i', [0, 1, 2, 3, 4, 5, 7, 8, 5, 9, 10, 5])
Expected Answer:
The initial array: array('b', [0, 1, 2, 3, 4, 5, 7, 8, 5, 9, 10, 5])
Quantity of occurrences for number 5 in the array_a: 3
Sample Answer:
from array import * array_a = array('b', [0, 1, 2, 3, 4, 5, 7, 8, 5, 9, 10, 5]) print("The initial array: "+str(array_a)) print("Quantity of occurrences for number 5 in the array_a: "+str(array_a.count(5)))
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)