What might be missing with this?


#1

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

std_list = [lloyd, alice, tyler]

Add your function below!

def average(numbers):
total = sum(numbers)
total = float(total) / len(numbers)
return total

def get_average(students):
std_hm = students["homework"]
std_qz = students["quizzes"]
std_ts = students["tests"]

homework = average(std_hm)
quizzes = average(std_qz)
tests = average(std_ts)

h_weight = homework * .1
h_quizzes = quizzes * .3
h_tests = tests * .6

ave = h_weight + h_quizzes + h_tests
return ave

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

#print grade
return grade

def get_class_average(students):
results = []

for stud in students:
    val = get_average(stud)
    results.append(val)
    result = average(results)

#print result
return result
#print average(results)
#return average(results)

std_avg = get_class_average(std_list)
print std_avg
print get_letter_grade(std_avg)

What might be missing with this? I have already created a list of std_list containing the 3 students

Output:
83.8666666667
B
None

Error encountered:
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 apologize as I am really trying to learn Python. Unfortunately, I could not find where my mistakes are.


Oops, try again. One of the following is missing or broken when we tried to use it: alice, lloyd, tyler, students, get_class_average, get_letter_grade
#2

Hi @pauloriondo,

You have this line in your code ...

std_list = [lloyd, alice, tyler]

However, Codecademy expects the list to be named students.

See Restoring the missing students list.


#3

Thank you for your answer.
Will check on it tomorrow.

Regards,
Paul


#4

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