Someone please help me with this code


#1



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


i don't know what to do I've tried everything it keeps on asking did you define get_average is this a bug or something


lloyd = {
    "name": "Lloyd",
    "homework": [90.0, 97.0, 75.0, 92.0],
    "quizzes": [88.0, 40.0, 94.0],
    "tests": [75.0, 90.0]
}
alice = {
    "name": "Alice",
    "homework": [100.0, 92.0, 98.0, 100.0],
    "quizzes": [82.0, 83.0, 91.0],
    "tests": [89.0, 97.0]
}
tyler = {
    "name": "Tyler",
    "homework": [0.0, 87.0, 75.0, 22.0],
    "quizzes": [0.0, 75.0, 78.0],
    "tests": [100.0, 100.0]
}

def average(numbers):
    sum(numbers)
    total=sum(numbers)
    total = float(total)
    return total/len(numbers)
   
    def get_average(student):
      return average(student["homework"]) * 0.1 + \
    average(student["quizzes"]) * 0.3 + \
    average(student["tests"]) * 0.6


#2

The way you have indented def get_average places it inside of you average function. If you change it indentation you'll be good.


#3

All of your indentation is off!

Python will give errors if there are indentation issues, so make sure to fix them. You are defining get_average(student) within average(numbers). Unlike languages like Java, there are no closing characters such as the opening and closing curly braces - { }. Therefore, you need to have everything indented to account for that.


#4

dosent it suppose to say like indentation errors or something it just says none dosent that mean everything is cool.


#5

None means you didn't return or print anything.


#6

Thanks really helped a lot


#7

Happy to help, don't hesitate to ask questions like these on the forums again. Good luck.


#8

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.