9/9 How is Everybody Doing?


#1

Hi there,

i stuck in the lesson. Got a output, it is right (i got the code after 1,5h), but i got a error message.
Please tell me what i do wrong. I go forward now, but i want to know whats happen.
Maybe something is missing, but why i got the correct output.
Thank you, i am new in coding

Link to lesson:
https://www.codecademy.com/courses/learn-python/lessons/student-becomes-the-teacher/exercises/how-is-everybody-doing-?action=lesson_resume

Error message:
One of the following is missing or broken when we tried to use it: alice, lloyd, tyler, students, get_class_average, get_letter_grade

<What do you expect to happen instead?>
83.8666666667
B # and the message in kind of :Yay go next and so on :frowning:



class_list = [lloyd, alice, tyler]
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)
    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
    results = [ ]

def get_class_average(class_list):
    for student in class_list:
    student_avg = get_average(student)
    results.append(student_avg)
    return average(results)

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"
  
cl_av = get_class_average(class_list)
print cl_av

cl_gr = get_letter_grade(cl_av)
print cl_gr




#2

Hi @ser_1of744000000,

You are missing this line from Exercise 3: Put It Together

students = [lloyd, alice, tyler]

Though you have this line …

class_list = [lloyd, alice, tyler]

… Codecademy’s submission correctness test (SCT) looks for the one you created in that earlier exercise.


#3

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