Question: Using concepts which you were specifically told not to use Use of global variables, break or continue statements in loops ( while these statements are
Using concepts which you were specifically told not to use
Use of global variables, break or continue statements in loops while these statements are useful to provide multiple exit points in loops, they are highly abused when starting to program instead of defining a meaningful continuation condition. None of the problems in this course involve complex exit points, hence, their use is prohibited in all components of this course
Question #: employeeupdate bonus, year
Modifies the given dictionary 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
: dict
bonus: intfloat
year: int
Returns: dict adds the key:value pair with bonus applied
Recommended methods:
dict.keys returns all the keys in a dictionary
'one': 'two': 'three': 'four':
Dkeys 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
mapping to another key in and then changing information in will also change the data in
which is not a desirable behavior. When adding a new key, create new dictionaries and
lists and populate them with the required data.
Examples:
records
:John: Managing Director", "Fulltime", "Sally":HR Director", "Full
time", "Max": Sales Associate", "Parttime",
:John: Managing Director", "Fulltime", "Sally":HR Director", "Full
time", "Max": Sales Associate", "Parttime",
employeeupdaterecords
: John: Managing Director', 'Fulltime', 'Sally': HR Director', 'Full
time', 'Max': Sales Associate', 'Parttime',
: John: Managing Director', 'Fulltime', 'Sally': HR Director', 'Full
time', 'Max': Sales Associate', 'Parttime',
: John: Managing Director', 'Fulltime', 'Sally': HR Director', 'Full
time', 'Max': Sales Associate', 'Parttime',
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
