Un-defined word inside function


#1

lloyd = {“name”:“Lloyd”, “homework”:[], “quizzes”:[], “tests”:[]}
alice = {“name”:“Alice”, “homework”:[], “quizzes”:[], “tests”:[]}
tyler = {“name”:“Tyler”, “homework”:[], “quizzes”:[], “tests”:[]}

#short-hand process
people = [lloyd,alice,tyler]
for person in people:
person[“homework”] = [90.0, 97.0, 75.0, 92.0]
person[“quizzes”] = [88.0, 40.0, 94.0]
person[“tests”] = [75.0, 90.0]

students = [lloyd,alice,tyler]

for student in students:
print (student[“name”])
print (student[“homework”])
print (student[“quizzes”])
print (student[“tests”])

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

#Compute student average
def get_average(student):
homework = average(student[“homework”])
quizz = average(student[“quizzes”])
test = average(student[“tests”])
return 0.1 * homework + 0.3 * quizz + 0.6 * test

In the above code inside function get_average(student) I have used “student” as per instructed by codeacademy but “student” is never defined. So, I am confused how does “student” came in existance without any defination.


#2

A function doesn’t define its input, that’s kind of the point. It’s provided when the function is called