Editor

Find the Highest Scorer

Intermediate · Write the code · from Working with Nested Lists, Dicts, and Complex Data Structures

From the lesson: Working with Nested Lists, Dicts, and Complex Data Structures

Think about a school. A school has classrooms. Each classroom has students. Each student has a name, an age, and a list of grades. That's data inside data inside data - nested data.

Read the lesson

Loop through the list of students and find the one with the highest grade. Print their name and grade in the format: Best: Name (Grade)

students = [
{'name': 'Alice', 'grade': 88},
{'name': 'Bob', 'grade': 95},
{'name': 'Charlie', 'grade': 72},
{'name': 'Diana', 'grade': 91},
]
# Find and print the highest scorer

More nested data exercises

All Python exercises · 50 practice problems · Data Structures quiz