4/9 - Where is Lloyd?


#1

Hi,
I have problem in this exercise.
I wrote my code but something goes wrong.
Help me please!
Thx

This is my code:

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: %s" % student["name"]
print "Student homework: %s" % student["homework"]
print "Student quizzes: %s" % student["quizzes"]
print "Student tests: %s" % student["tests"]
print

This is result:

Student name: Lloyd
Student homework: [90.0, 97.0, 75.0, 92.0]
Student quizzes: [88.0, 40.0, 94.0]
Student tests: [75.0, 90.0]

Student name: Alice
Student homework: [100.0, 92.0, 98.0, 100.0]
Student quizzes: [82.0, 83.0, 91.0]
Student tests: [89.0, 97.0]

Student name: Tyler
Student homework: [0.0, 87.0, 75.0, 22.0]
Student quizzes: [0.0, 75.0, 78.0]
Student tests: [100.0, 100.0]

None

And this is error message:

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


#2

Try using this:
for student in students:
print student["name"]
print student["homework"]
print student["quizzes"]
print student["tests"]
print


#3

it works.
Thank you.


#4

I was doing this the same way as haxwell, is it merely for the course? Or is there something wrong with doing it that way?


#5

Its for the course. You just added extra text which would be fine except that the course couldn't read your answer as correct.


#6

extra text aren't allowed lol