4. For the Record


Hello guys. We have this 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]


How to print the required information? We have to use a for cicle but I don't know how to print because it is a list of dictionaries.


Fixed, no worries :slight_smile:


Could you explain the solution?


We have the list students=[lloyd,alice,tyler].

We have to set a for cicle for each student and print the information. That means that we have to set 3 for cicle.

The first one is the following:

for x in lloyd:
print lloyd[x]

The other 2 will be the same, just the name will change.


I hope it helped. I am relatively new and I did't realize if I can write the whole code. Please let me know if you need more help.


how to print student data?


for x in lloyd:
print lloyd[x]

for x in alice:
print alice[x]

for x in tyler:
print tyler[x]

Let me know if you solved the issue


To print the student data:

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


Thanks! I got it now.