Question: Python Suppose a dictionary mgrDict maps managers to a department: mgrDict = { } Suppose a dictionary mgrEmpsDict maps managers to a a LIST Of
Python
| Suppose a dictionary mgrDict maps managers to a department:
mgrDict = { } | Suppose a dictionary mgrEmpsDict maps managers to a a LIST Of their employees:
mgrEmpsDict = { } |
| 1. Ask the user to enter a mgrName and a department Insert an entry into the mgrDict | 1. Ask the user to enter a mgrName Ask the user to continue adding empNames until they enter -999 to quit Insert an entry into the mgrEmpsDict |
| 2. Ask the user to enter a department Print the name of the manager of that department OR print no such department if its not in the mgrDict. | 2. Ask the user to enter an empName. Print the name of the manager for that employee OR print no such employee if they arent in the mgrEmpsDict. |
| 3. Ask the user for a department Ask the user to enter a new manager Replace the manager for that department with the new manager OR print a message if that department doesnt exist. | 3. Ask the user for a new employees name. Ask the user for the name of a manager. Insert that employee into the list for that manager OR print a message if the manager doesnt exist. |
| 4. Print a report where the output is SORTED by department. | 4. For each entry in mgrEmpsDict, print the manager name followed by the number of employees for that manager. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
