9/9 "How Is Everybody doing?" - Error and stuck


#1

Hello!

On 9/9, I get what seems as the correct output, by using the correct code (as I see it on other answers for errors on this same exercise), but the system understands something is missing, and displays a feedback I cannot use to move on.

My code is as follows:

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

def get_average(student):
homework = average(student[“homework”])
quizzes = average(student[“quizzes”])
tests = average(student[“tests”])
return homework0.1 + quizzes0.3 + tests*0.6

def get_letter_grade(score):
if score >= 90:
return "A"
elif score >= 80 and score < 90:
return "B"
elif score >=70 and score < 80:
return "C"
elif score >= 60 and score < 70:
return "D"
else:
return “F”

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

class_list = [lloyd, alice, tyler]
print get_class_average(class_list)
print get_letter_grade(get_class_average(class_list))`

The output is the following one:
83.8666666667
B

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

I am seriously stuck, and cannot understand what I am doing wrong.

Any help is welcome!

Thanks!


#2

students seems to be missing, i don’t see it? the exercise wants class_list to be named students (at least, the global list that is)


#3

Students is the one missing, try defining that in the code, maybe it will work


#4

Thanks!

Changed “class_list” to “students” in

class_list = [lloyd, alice, tyler]
print get_class_average(class_list)
print get_letter_grade(get_class_average(class_list))

so it now reads

students = [lloyd, alice, tyler]
print get_class_average(students)
print get_letter_grade(get_class_average(students))

and it worked!

Is this a problem with the exercise wanting the list to be passed especifically named “students”, or a real problem with the coding?

Anyway, thanks a lot for the quick help! :slight_smile:


#5

the exercise, looking for a specific name for validation purpose


#6

Ok, got it.

Thanks a lot! :smile:


#7