-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomprehension_exercise.4py.py
More file actions
32 lines (27 loc) · 977 Bytes
/
comprehension_exercise.4py.py
File metadata and controls
32 lines (27 loc) · 977 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# given a list of employee name,employee salary and appraisal pointers;
# calculate hike given to each employee.
#store the data in dictionary
n=int(input("Enter number of employees : "))
emp_name=[]
emp_sal=[]
emp_ptr=[]
print("Enter employee name,their salary and appraisal pointers")
for i in range(n):
emp_name.append(input("Enter name of emp : " ))
emp_sal.append(float(input("Enter salary of emp : ")))
emp_ptr.append(float(input("Enter appraisal pointer of emp: ")))
def calculateHike(name,sal,ptr):
if(ptr>=4.7):
tempptr=15
elif(ptr>=4.3 and ptr<=4.6):
tempptr=13
elif(ptr>=4 and ptr<=4.2):
tempptr=10
elif(ptr>=3.5 and ptr<4):
tempptr=4
elif(ptr<3.5):
tempptr=0
salaryHike=sal+sal*(tempptr/100)
return name,sal,ptr,salaryHike
Dictionary={name:[sal,ptr,newSal] for name,sal,ptr,newSal in map(calculateHike,emp_name,emp_sal,emp_ptr)}
print(Dictionary)