Answered step by step
Verified Expert Solution
Link Copied!

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 100.Currently, the teacher has a dictionary setup for Term 1 grades and wants to duplicate it for Term 2. The studentname keys in the dictionary should stay the same, but the grade values should be reset to 0.Complete the "setup_gradebook" function so that input like ""J ames": 93, "Felicity": 98, "Barakaa": 8o}" willproduce a resulting dictionary that contains ""James": 0, "Felicity": 0, "Barakaa": 0)". This function should:1. accept a dictionary "old_gradebook" variable through the function's parameters;2. make a copy of the "old_gradebook" dictionary;3. iterate over each key and value pair in the new dictionary;4. replace the value for each key with the number 0;5. return the new dictionary.124567891e1112def 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 e.return new gradebookfall_gradebook =("James" : 93, "Felicity" : 98, "Barakaa": 80}print(setup_gradebook (fall_gradebook))# Should output ampc
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

5. Describe how contexts affect listening

Answered: 1 week ago