Final answer:
The setup_gradebook function is defined to accept a dictionary of student grades, create a copy of that dictionary, reset each student's grade to 0, and return the new dictionary with the updated grades.
Step-by-step explanation:
To complete the setup_gradebook function in Python, we need to make a copy of the old_gradebook dictionary and reset the values to 0. Below is a step-by-step explanation of how this can be achieved:
- Define the function setup_gradebook and have it accept one parameter, old_gradebook.
- Create a new dictionary by copying the old_gradebook.
- Iterate over the new dictionary's items and set each value to 0.
- Return the new dictionary with the reset values.
Here is a sample implementation of the setup_gradebook function:
def setup_gradebook(old_gradebook):
new_gradebook = old_gradebook.copy()
for student in new_gradebook:
new_gradebook[student] = 0
return new_gradebook
When you use this function and provide a dictionary like {"James": 93, "Felicity": 98, "Barakaa": 80}, the result will be a new dictionary with zeroes for all grades: {"James": 0, "Felicity": 0, "Barakaa": 0}.