Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given a dictionary d , that contains employee information in the format { employee _ id: { ' name ' : name, 'position': position, 'department':

Given a dictionary d, that contains employee information in the format {employee_id:
{'name': name, 'position': position, 'department': department}}, returns a
new dictionary with the employee information by department using the format {department:
[{'emp_id': employee_id, 'name': name, 'position': position},{'emp_id':
employee_id, 'name': name, 'position': position}]}. Note that employee id
becomes the key and it disappears as a value in the inner dictionary. Do not mutate (change) the
original dictionary.
Preconditions and Postconditions
d: dict with format {employee_id: {'name': name, 'position': position,
'department': department},...}
Returns: dict with format {department: [{'emp_id': employee_id, 'name': name,
'position': position},{'emp_id': employee_id, 'name': name, 'position':
position}],...

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

Recommended Textbook for

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions

Question

4. Describe cultural differences that influence perception

Answered: 1 week ago