Solution: Class Grades
Explore how to manage student grade data using lists of dictionaries in Python. This lesson helps you understand storing multiple student records, iterating with loops, and accessing dictionary values to display information clearly.
We'll cover the following...
We'll cover the following...
This program stores a list of students with their scores and then prints each student’s name and score.
studentsis a list containing dictionaries.Each dictionary represents one student with two pieces of information:
"name"→ the student’s name"score"→ their test score
The
forloop goes through each student dictionary one by one.Inside the loop:
student['name']gets the student’s name.student['score']gets their score.
The
print()statement displays both pieces of data in one sentence.