Error line 152?


#1



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


I got this error in my code:

Traceback (most recent call last):
File "python/cli_runner.py", line 152, in


What did I do wrong? I don't understand what the error is. There is no line 152, is it?


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]
}

# Add your function below!
def average(numbers):
    total = sum(numbers)
    total = float(total)
    total = total / len(numbers)
    return total
    
def get_average(student):
    homework = average(student["homework"]) * 0.1
    tests = average(student["tests"]) * 0.6
    quizzes = average(student["quizzes"]) * 0.3
    return homework + tests + quizzes
    print homework + tests + quizzes
    

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


#2

This line is not causing any issues but you should know that anything after return is unreachable. The interpreter never sees that line.

The issue as indicated by the error message is not to do with your code, but the environment. Be sure your code is saved (submit it) AND take a copy of it, then refresh the page. You should be able to resubmit after kickstarting a new sesssion.

Is there some reason for having the same function twice?


#3

I have tested different combinations so probably that's the reason that I have the same function twice. I have already refreshed numerous times but I still get this error everytime. I even tried to reset code and then wrote it again but as soon as I insert first if statement I get this error again.

I don't know what should I do...


#4

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