Part of a Whole - General question


#1

Hey so this is the code that i got to work for Part of a whole

def get_class_average(students):
results = []
for student in students:
results.append(get_average(student))
return average(results)

the part that i dont get is the for condition/statement, especially this part:

for student in students

what is "student" or where is it called from?


#2

Hello, @itwasthisbig!
The parameter students is your list, where you'll iterate through it using the for loop.
The variable you'll use to iterate through is student. Each time the loop is executed, it will get one part of your list, which is this case is lloyd, and use that as a parameter to get the result from the average of his grades.

Just remember: for iterationVariable in whereTheIterationWillHappen

Hope that's clear now!
Best regards,

g4be