Stuck on For The Record - "Lloyd's homework scores weren't printed correctly."


#1

When submitting my code for "For the Record" I am getting the following error:

Oops, try again.
Did you print out each student's homework scores? It looks like Lloyd's homework scores weren't printed correctly.

In the console his numbers are printing, along with the other students' The only difference I can see is Lloyd's numbers were added after the dictionary was created. I didn't think that should matter, am I wrong or just missing something else obvious?

Lloyd's work prints out first and looks like this in the console:

Lloyd
Homework: (90.0, 97.0, 75.0, 92.0)
Quizzes: (88.0, 40.0, 94.0)
Tests:(75.0, 90.0)

https://www.codecademy.com/en/courses/python-beginner-en-qzsCL/0/4?curriculum_id=4f89dab3d788890003000096

lloyd = {
    "name": "Lloyd",
    "homework": [],
    "quizzes": [],
    "tests": []
}
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]
}

lloyd["homework"] = 90.0, 97.0, 75.0, 92.0
lloyd["quizzes"] = 88.0, 40.0, 94.0
lloyd["tests"] = 75.0, 90.0

students = [lloyd, alice, tyler]

for student in students:
    print student["name"]
    print "Homework: " + str(student["homework"])
    print "Quizzes: " + str(student["quizzes"])
    print "Tests:" + str(student["tests"])
    print

#2

Compare to what's printed for the others and consider what would cause that difference. Also make sure that your're following the described format exactly.


#4

Thanks for the assistance! I fixed up the print statements to use print ("%s" % student["name"]) instead and it's all happy.


#5

3 posts were split to a new topic: Please look at this code:


#9

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