-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNetSalaryDictFile.py
More file actions
33 lines (32 loc) · 879 Bytes
/
NetSalaryDictFile.py
File metadata and controls
33 lines (32 loc) · 879 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
33
import pickle
bfile = open("empfile", "wb")
n = int(input("Enter the number of employees:"))
print("Enter records of Employees")
i = 1
edata = dict()
while i <= n:
print("Record No:", i)
ename = input("Employee name:")
ebasic = int(input("Basic Salary:"))
ns = int(input("Enter the no of Night shifts: "))
hra = ebasic * .15
pf = ebasic * .08
da = ebasic * .05
totsal = ebasic + hra + da - pf + (ns * 300)
print("NET SALARY:", totsal)
edata["Empno"] = i
edata["Name"] = ename
edata["Basicsalary"] = ebasic
edata["Totalsalary"] = totsal
pickle.dump(edata, bfile)
i = i + 1
bfile.close()
print("Reading the employee records from the file")
empno = 1
bfile = open("empfile", "rb")
while empno < n + 1:
edata = pickle.load(bfile)
print("Record Number:", empno)
print(edata)
empno = empno + 1
bfile.close()