How do I find the mean by referring to each element of the data below and how do I find the mean as an object?
import numpy as np
x = np.array ([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])
print('x[0]=',x[0],'x[10]=',x[10])
import numpy as np
x = np.array ([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])
# calculate the average of the elements by dividing them by the number
sum = 0
for num in x:
sum+=num
print(sum/len(x))
# Use average method as array object for numpy
print(np.average(x))
© 2023 OneMinuteCode. All rights reserved.