import numpy as npdef mean(x):
N = np.size(x) # x.size
s = 0.0
for i in range(N):
s += x[i]
return s / Nrng = np.random.default_rng() # instantiating an RNG class
x = rng.normal(size = 10) # use rng instance to generate random numbers => ndarray
xarray([ 0.53768287, 0.48044289, 0.41968892, 0.53617612, 0.12008546,
2.36768986, 0.17752883, 0.68915822, 0.07121943, -0.29874026])
np.isclose(mean(x), np.mean(x)) # don't == floats/doublesTrue