Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the following scenario about using Python dictionaries:A teacher is using a dictionary to store student grades. The grades are stored as a point value
Consider the following scenario about using Python dictionaries:A teacher is using a dictionary to store student grades. The grades are stored as a point value out of Currently, the teacher has a dictionary setup for Term grades and wants to duplicate it for Term The studentname keys in the dictionary should stay the same, but the grade values should be reset to Complete the "setupgradebook" function so that input like J ames": "Felicity": "Barakaa": o willproduce a resulting dictionary that contains James: "Felicity": "Barakaa": This function should: accept a dictionary "oldgradebook" variable through the function's parameters; make a copy of the "oldgradebook" dictionary; iterate over each key and value pair in the new dictionary; replace the value for each key with the number ; return the new dictionaryedef setup gradebook old gradebook :# Use a dictionary method to create a new copy of the "old gradebook".# Complete the for loop to iterate over the new gradebook.for# Use a dictionary operation to reset the grade values to ereturn new gradebookfallgradebook James : "Felicity" : "Barakaa": printsetupgradebook fallgradebook# Should output ampc
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started