I have problems with a) excersise b) exrs bug reporting


#1

How it's possible?

I see the right result of the program (on the console that is at the right upper corner of the sceen) and on the other hand I see "Ooops!"-message at the buttom, whish says that "something wrong with objects of the program"

Screen shot is atthached.

And whan I tried to report the bug, I got some "404 errors"

.


#2

May I ask you to post here your code?

You don't have to paste it here, create gist and post here only a link :smile:


#3

I'm getting the same error.

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 = float(sum(numbers))
    return total / (len(numbers))

def get_average(student):
    homework = average(student['homework'])
    quizzes = average(student['quizzes'])
    tests = average(student['tests'])

return (homework * 0.10) + (quizzes * 0.3) + (tests * 0.60)

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"

def get_class_average(students):
    results = []
    for student in students:
        results.append(get_average(student))
    return average(results)    
    
    
print get_class_average([lloyd, alice, tyler])
print get_letter_grade(get_class_average([lloyd, alice, tyler]))

#4

Thanks for posting :smile:

In the first instruction you were asked to create a students list:

students = [lloyd, alice, tyler];

You only have to add this line to your code.

You can also refactor your code to use this list. Now, at the end of your script you don't have to type whole list as a parameter, you can just pass created variable:

print get_class_average(students)
print get_letter_grade(get_class_average(students))