Student becomes the teacher right code, not working


#1

Okay, so this is the code i have and its telling me "Lloyd wasnt printed" which is it being 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"],
print student["homework"],
print student["quizzes"],
print student["tests"],

ANSWER:

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

but then it says:

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


#2

It's because of my comma "," at the end of my code.................. THAAAAAANKS!!!


#3

Whenever we see repetition in our code the D.R.Y. flag should pop up. We always want to find ways to reduce repetition.

Also, your code ends these lines with a comma, which should be throwing an error. They are not needed, but I see you caught that already.

Let's look for a way to reduce the repetition and promote scalability.

for student in students:
    for key in student:
        print student[key]

Making any sense?


#4

hey thanks! yes that does make sense but with the way codecademy goes through the lessons they want u to input a certain criteria . i finished this lesson and i think towards the end they promoted scalability. im still wrapping my head around coding i just started a week ago (tweekin yo).