For the record


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 key in students:
print students

tried this first but it gave the following error:
Oops, try again. Did you print out each student's name? It looks like "Lloyd" wasn't printed.
code went through when i replaced
for key in students:
print students
for students in students:
print students

my question is why? and how do i print it in a specific order? say name first and quizzes last because it seems to print out the list randomly

Replace this line with your code.


this can work:

for key in students:
    print students

if you print key it works, given key (the loop iterator) will contain all the keys from dictionary

dictionaries are unordered by nature (except for python3.6 and onwards, not sure why) because they are accessed by key and not by index, it used to more efficient to let dictionary be unordered.


Yeah I don't know how you can print in the right order - I have the same question. for me

for key in students:
print students

throws back an error saying "lloyd wasn't printed" even though he was


Please stop hijacking topics, see guidelines, create new or linked topics