Problem in "How is Everybody Doing?"


#1

Hello,

I have a problem in this unit. The name of the unit is called "How is Everybody Doing?"

My code is running, but I get an error message: Oops, try again. One of the following is missing or broken when we tried to use it: alice, lloyd, tyler, students, getclass_average, get_letter_grade_

I think there is a problem, maybe just with the printout.


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

s_list = [lloyd, alice, tyler]


#Function

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 >= 90:
        return "A"
    elif score >= 80:
        return "B"
    elif score >= 70:
        return "C"
    elif score >= 60:
        return "D"
    else:
        return "F"
#thats the startpoint at this unit
def get_class_average(class_list):
    results = []
    for l in class_list:
        print("l: {}".format(l))
        results.append(get_average(l))
        #results = results.append(get_average(l))
    return average( results)

gcl=get_class_average(s_list)
#print("get class average: {}".format(gcl))
#print("get_letter_grade: {}".format(get_letter_grade(gcl)))

print("students")
print(get_class_average(s_list))
print(get_letter_grade(s_list))

thx for help!


#2

Im not sure why you defined a new variable called gcl=get_class_average(s_list). By doing this your second line of print text (print(get_class_average(s_list)) would print the get_class_average of get_class_average which does not work.


#3

6 posts were split to a new topic: Giving answers to problems


#4

While you may satisfy yourself by embellishing the code and getting a nice product, it is not asked for in the instructions.


#5

you have to replace student everywhere In there with "s_list"


#6

Hi, @_moep ,

You have this assignment statement that creates a list ...

s_list = [lloyd, alice, tyler]

Among the objects that are listed in Codecademy's message as possibly being missing or broken is students. See the instructions in Exercise 3: Put It Together, regarding the list that you created, then make some adjustments based on those instructions.


#7

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