Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Modifies the given dictionary d by adding another key:value assignment for all employees but with a bonus for the next year. You can assume the

Modifies the given dictionary d by adding another key:value assignment for all employees but with a bonus for the next year. You can assume the previous year exists in the dictionary.
Preconditions and Postconditions
d: dict
bonus: int/float
year: int
Returns: dict adds the key:value pair with bonus applied
Recommended methods:
dict.keys(), returns all the keys in a dictionary
'one': 1, 'two': 2, 'three':3, 'four':4})
D.keys() returns ['one', 'two', 'three', 'four']
List concatenation (+) or append method
Tip: Dictionaries, just like lists, are mutable, so saving a reference to a dictionary, say x=d[2020], mapping x to another key in d and then changing information in x, will also change the data in d[2020], which is not a desirable behavior. When adding a new key, create new dictionaries and lists and populate them with the required data.
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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions

Question

=+2. What do they like better about its competition?

Answered: 1 week ago

Question

1. Diagnose and solve a transfer of training problem.

Answered: 1 week ago