Just weight and see


#1


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

Oops, try again. get_average(alice) raised the following error: local variable 'average' referenced before assignment

I don't really know what's happening here, pls HELP!


def average(numbers):
    total = sum(numbers)
    total = float(total)
    total = total / len(numbers)
    return total
def get_average(student):
    homework = average(student["homework"])
    quizzes = average(student["quizzes"])
    tests = average(student["tests"])
    homework = homework * 10
    quizzes = quizzes * 30
    tests = tests * 60
    average = homework + quizzes + tests
    return average


#2

In this part

you have created variable which has the same name as one of the functions. I am not sure if this is correct reason, but try with changing it to something else.

BTW, are you sure you want to multiply averages by 10, 30 and 60?


#3

I have the same error code

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


#4

I have a pretty similar issue

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

Error:
Oops, try again. get_average(alice) raised the following error: sum expected at most 2 arguments, got 3

console says none


#5

Never mind, it fixed itself when I just added them manually rather than using the built in function to get their sum.