# Lloyd's, alice's and tyler's name and marks refuse to show

#1

Oops, try again. Did you print out each student's name? It looks like "Lloyd" wasn't printed.

I would like the students name and marks to show

``````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:
if student == "lloyd":
print lloyd["name"]
print lloyd["homework"]
print lloyd["quizzes"]
print lloyd["test"]
if student == "alice":
print alice["name"]
print alice["homework"]
print alice["quizzes"]
print alice["test"]
if student == "tyler":
print tyler["name"]
print tyler["homework"]
print tyler["quizzes"]
print tyler["test"]``````

#2

take a moment to see what student contains:

``````for student in students:
print student``````

it contains the dictionary's. How can a dictionary be equal to a string? In fact, what you do sort of defeat the purpose of loops, since (thanks to the loop) the variable student will hold each dictionary in turn, you could simple do:

``````for student in students:
print student["name"]``````

to print the name of all the students

#3

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