Part of the Whole


Hi, i have written my code.
i found that there is problem in for loop,
ie classes how can i write the for loop.

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

can any one tell me how to write for loop in this program. i know how to write. but it showing me wrong.


append will update the list, you don't need to update the variable as well. and you are currently appending nothing to the list.

a function ends the moment a return keyword is reached, this currently happens in the first iteration of your loop.

you should loop over students, the function parameter


thank you i got the code