I need to find a way to count how many times each number from 0 to 9 appears in a random matrix created using np.random.randint()
import numpy as np
p = int(input("Length of matrix: "))
m = np.random.randint(0,9,(p,p))
print(m)
For example if length of matrix = 4
- [[3 4 6 5] [3 4 4 3] [4 2 4 8] [6 8 2 7]]
How many times does the number 4 appear? It should return 5.