import numpy as np
import matplotlib.pyplot as pltdef cummean(x):
N = np.size(x)
out = np.zeros(N) # np.zeros_like(x)
s = 0
for n in range(N):
s += x[n]
out[n] = s / (n + 1)
return outrng = np.random.default_rng()
x = rng.normal(size = 100)plt.plot(np.arange(100), cummean(x))