I don’t know why I am getting an error of index. I am quite new to python and therefore am not able to figure out what to do. I think I am initialzing some wrong dimensions but I am not able to break it.
import numpy as np
import matplotlib as plt
x = np.array([45, 68, 41, 87, 61, 44, 67, 30, 54, 8, 39, 60, 37, 50, 19, 86, 42, 29, 32, 61, 25, 77, 62, 98, 47, 36, 15, 40, 9, 25, 34, 50, 61, 75, 51, 96, 20, 13, 18, 35, 43, 88, 25, 95, 68, 81, 29, 41, 45, 87,45, 68, 41, 87, 61, 44, 67, 30, 54, 8, 39, 60, 37, 50, 19, 86, 42, 29, 32, 61, 25, 77, 62, 98, 47, 36, 15, 40, 9, 25, 34, 50, 61, 75, 51, 96, 20, 13, 18, 35, 43, 88, 25, 95, 68, 81, 29, 41, 45, 87])
len_x = len(x)
mean = np.mean(x)
xup = np.zeros(shape=(1,120))
for i in range(len_x) :
xup[i] = (x[i] - mean) ** 2
xup_sum = np.sum(xup)
var = xup_sum / len_x
std_dev = var ** 0.5
z = np.zeros(shape = (1,120))
for i in range(len_x) :
z[i] = (x[i] - mean)/std_dev
print("Mean :", mean)
print("Standard_dev :",std_dev)
print("Variance : ",var)