This worked on "For the Record", is it bad practice?


#1

Specifically, the last line. print students.

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]

print students


#2

why would it be bad practice?


#3

I guess I’m just saying that it worked because the instructions were to print the keys in the exact order they were already listed in. If they wanted test scores excluded, or a different order, “print students” would no longer work. So in this instance that was the easiest way, but is there a more correct way. I guess I just felt some of the other people’s solutions on here seemed much more verbose.


#4

this shouldn’t work for for the record, please use and make a nice looking printout as asked by the instructions. After all, you are here to learn


#5

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