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(list):
    list_of_numbers = 0
    list_of_items = 0
    for item in list:
        list_of_numbers += item
        list_of_items = list_of_items + 1
    return list_of_numbers / list_of_items

In [2]:
numbers = [1,2,3,4,5]

In [3]:
get_mean(numbers)


Out[3]:
3.0

In [ ]: