Write a function that takes in a list of numbers and outputs the mean of the numbers using the formula for mean.


In [78]:
numbers = input("Enter a list of numbers: ")


Enter a list of numbers: 123,333,231,445,12

In [82]:
int_list = numbers.split(",")
int_list


Out[82]:
['123', '333', '231', '445', '12']

In [80]:
def caculate(x):
    total = 0 
    count = 0
    for i in int_list:
        total = total + int(i)
        count = count + 1
        mean = total/count
    return mean

In [81]:
print("The mean of the numer is:", caculate(int_list))


228.8

In [ ]: