Solution: Create a Dictionary and Replace Key-value Pairs
Explore how to create a dictionary in Python with student names and scores, then replace their values by computing total and average scores. Understand how to iterate over nested dictionaries, update values efficiently, and identify the top student based on average scores.
We'll cover the following...
We'll cover the following...
The solution to the problem of creating a dictionary that contains students’ names and scores, and then replacing the scores with the total and average scores is given below.
Solution
Explanation
- Lines 1–5: We create a dictionary
studentsthat contains