Write a function that takes in a list of numbers and outputs the mean of the numbers using the formula for mean. Do this without any built-in functions like sum(), len(), and, of course, mean()
In [1]:
def get_mean(numbers):
total=0
count=0
for number in numbers:
total+=number
count+=1
return total/count
In [10]:
from numpy import mean
list1=[1, 2, 3, 1, 345, 23, 1234, 321, 34345, 1232, 321, 34, 1233, 54213, 2321, 2, 12, 34, 43]
print(sum(list1)/len(list1))
print(mean(list1))
print(get_mean(list1))
In [ ]: