# For the record

#1

"Oops, try again. Did you print out each student's homework scores? It looks like Lloyd's homework scores weren't printed correctly. " But when I look at the printout, I think it should be correct:
Lloyd
90.0
97.0
75.0
92.0
88.0
40.0
94.0
75.0
90.0
Alice
100.0
92.0
98.0
100.0
82.0
83.0
91.0
89.0
97.0
Tyler
0.0
87.0
75.0
22.0
0.0
75.0
78.0
100.0
100.0
None

I expect the code to pass and move on (I double checked and all the scores printed).

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

students = [lloyd,alice,tyler]

for student in students:
print student["name"]
for home_work in student["homework"]:
print home_work
for quiz in student["quizzes"]:
print quiz
for test in student["tests"]:
print test``````

#2

print your homework, quizzes and tests exactly the same way you did with your names. (You only need one "for" loop).

#3

if you write this it should worke.

students = [lloyd, alice, tyler]
for student in students:
print student["name"]
print student["homework"]
print student["quizzes"]
print student["tests"]

#4

Why do I need to write the keys in quotations? e.g. print student["name"]?

#5

I THINK it is because it is referring to the "name" key in each dictionary, which is in quotations. So it is telling the program to use that particular key in each dictionary. Since keys are in quotations, this has to be as well.

I could be way off, and would like someone else to confirm or correct please

#6

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