A dictionary containg the id and names for five employees
employee_id_name_dict = [
{"id": 100, "name": "Bob"},
{"id": 102, "name": "Kelly"},
{"id": 105, "name": "Daniel"},
{"id": 110, "name": "Nyamai"},
{"id": 120, "name": "Mue"}
]
#A dictionary having the id's and salaries for the five employees
employee_id_salary_dict = [
{"id": 100, "salary": 85000},
{"id": 102, "salary": 74000},
{"id": 105, "salary": 68000},
{"id": 110, "salary": 62000},
{"id": 120, "salary": 56000}
]
print("\tEmployees_id_designation_dictionary = ")
print("\t[")
index = 0;
while index < len(employee_id_salary_dict):
my_id = employee_id_salary_dict[index]["id"]
my_salary = employee_id_salary_dict[index]["salary"]
designation = ""
if my_salary >= 80000 and my_salary <90000:
designation = "Project Manager"
elif my_salary >=70000 and my_salary < 80000:
designation = "Team Leader"
elif my_salary >=60000 and my_salary < 70000:
designation = "Software Developer"
else :
designation = "Software Trainee"
if(index != len(employee_id_salary_dict)-1):
print("\t\t{ 'id': "+str(my_id)+" 'designation': "+str(designation)+" },")
else:
print("\t\t{ 'id': " + str(my_id) + " 'designation': " + str(designation) + " }")
index = index + 1
print("\t]")
Comments
Leave a comment