Answer to Question #242782 in Python for Gopi

Question #242782
Suppose there is two different types of dictionary, one dictionary contains employee id and name of employee and another dictionary contains employee id and salary. Take 5 employee
details. Now display the employee's designation from the following condition:
If salary between 80,000 to 90,000:designation:Project Manager
salary between 70,000 to 80,000:designation:Team Leader
salary between 60,000 to 70,000:designation:Software Developer
salary between 50,000 to 60,000:designation:Software Trainee
Display result in the form of dictionary.
1
Expert's answer
2021-09-28T03:42:43-0400
dict_name = {
	1: 'John',
	2: 'Lisa',
	3: 'Marry',
	4: 'Tom',
	5: 'Michael'
}
dict_salary = {
	1: 50.000,
	2: 60.000,
	3: 85.000,
	4: 70.000,
	5: 88.000
}
dict_design = {}


for employee in dict_name:
	if dict_salary[employee] <= 90.000:
		if dict_salary[employee] >= 80.000:
			dict_design[employee] = 'Project Manager'
		elif dict_salary[employee] >= 70.000:
			dict_design[employee] = 'Team Leader'
		elif dict_salary[employee] >= 60.000:
			dict_design[employee] = 'Software Developer'
		elif dict_salary[employee] >= 50.000:
			dict_design[employee] = 'Software Trainee'
		else:
			dict_design[employee] = '_____'
	else:
		dict_design[employee] = '_____'


print(dict_design)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS