Part of the Whole


#1

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:
        get_average(student)
        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.


#2

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


#3

thank you i got the code


#4