Challenge: Class Grades
Explore how to build and manipulate lists of dictionaries containing student names and scores in Python. Practice using for loops to access and print personalized messages for each student, reinforcing your understanding of basic data structures and iteration in programming.
We'll cover the following...
Let’s practice working with lists, dictionaries, and loops together.
Create a list of students, where each student has a name and a score. Then loop through the list and print a message for each student.
Your task:
Create a list called
studentsEach item should be a dictionary with:
"name"→ the student’s name"score"→ their test score
Use a
forloop to print a message like the following for all students:Sam scored 87
💡 Hint: You’ll access dictionary values using square brackets, likestudent["name"]