Assignment 1

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]:
list_of_numbers = [1,5,3,7,1,7]
def get_sum():
    sumsum = 0
    for number in list_of_numbers:
        sumsum += number
    return sumsum

In [3]:
def get_mean():
    return get_sum()/len(list_of_numbers)

In [4]:
get_mean()


Out[4]:
4.0