I don't understand where numbers finds what to average


It has been asked before but I still don't understand:

def average(numbers):
total = sum(numbers)
total = float(total)
total = total / len(numbers)
return total

def average takes the numbers on a list called numbers and sums them, turn them into floats, divides them by their tally number and returns the total.
How does def average(numbers) know which list of numbers to take, it has never been defined as a list?
Many thanks, DD


def average(numbers) is just saying "Whatever input is given when average is called, assign the input to the variable 'numbers'"
So when you hit "Save and submit code", codeacademy calls the function with a variety of different inputs to make sure your code is correct.


Ah! Thank you. You do suspect that is but, not so sure about what I'm doing and the code I write there was always the doubt.
Thank you very much sicklad. Much appreciated.


This code works
def average (numbers):
total = float(sum(numbers))
return total/len(numbers)