Part of the whole


#1



https://www.codecademy.com/en/courses/python-beginner-en-qzsCL/1/4?curriculum_id=4f89dab3d788890003000096

hi.
in this exercise i receiving an error.

this is the error i received:
Oops, try again. get_class_average([alice, lloyd]) returned 91.15 instead of 85.85 as expected

i cant understand why its not working because the last exercise working great


# Add your function below!
def average(numbers):
    total = sum(numbers)
    total = float(total)
    return total/len(numbers)
    
def get_average(student):
    homework = average(student["homework"])
    quizzes = average(student["quizzes"])
    tests = average(student["tests"])
    return 0.1* homework + 0.3*quizzes + 0.6*tests
    
def get_letter_grade(score):
    if score >89:
        return "A"
    elif score>79:
        return "B"
    elif score>69:
        return "C"
    elif score>59:
        return "D"
    else:
        return "F"

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


#2

@lierez,
Try using this code

def get_average(student):
    homework = average(student["homework"])
    quizzes = average(student["quizzes"])
    tests = average(student["tests"])
    print 0.1* homework + 0.3*quizzes + 0.6*tests
    return 0.1* homework + 0.3*quizzes + 0.6*tests

and keep in mind
that if a return statement is encountered
a function will be exited !!!!!


#3

i am soooo stupid!!!!
the return statement of the function get_class_average was inside the for loop instead after the for loop.

thank you