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 lessonLoop 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
- Access Nested List ItemsBeginner
- Predict the Output: Nested Dict AccessBeginner
- Group Words by First LetterIntermediate
- Fix the Bug: Nested List TrapIntermediate
- Calculate Class AveragesAdvanced
All Python exercises · 50 practice problems · Data Structures quiz