Link to excercise: Just Weight and See
Hi all, I have done this exercise correctly but... I don't know why this works. Particularly, I want to know how this
get_average(students) function calls to the original
average(numbers) function when the
get_average(students) function doesn't have the argument
(numbers). I passed the excercise and even printed out
print get_average(lloyd) to see the interpreted result and it works. But, why?
Intuitively, I put
homework = average(numbers["homework"]) * 0.1 thinking it would properly call the first function but it doesn't. Can someone clear this misunderstanding up for me?
def average(numbers): total = sum(numbers) total = float(total) total /= len(numbers) return total def get_average(students): homework = average(students["homework"]) * 0.1 quizzes = average(students["quizzes"]) * 0.3 tests = average(students["tests"]) * 0.6 return homework + quizzes + tests print get_average(lloyd)