SOURCE CODE:
def empdata(): employees = {} n=
int(input("Enter no. of employees : "))
for i in range(n):
name = input("Enter employee's name = ") salary =
float(input("Enter employee's salary = ")) allowance =
float(input("Enter employee's allowance = ")) deductions =
float(input("Enter employee's deductions = "))
employees[name] = [salary, allowance, deductions] return
employees def totalsalary(employees):
total = 0
for emp in [Link]():
total = total + emp[0]
print("Total salary =", total) def
allowancededuction(employees):
totala = 0
totald = 0
for emp in [Link]():
totala = totala + emp[1] totald
= totald + emp[2] print("Total
allowance =", totala) print("Total
deductions =", totald) def
search(employees):
search = input("Enter employee to search = ")
if search in employees: emp =
employees[search] print("Employee
Found!") print("Name :", search)
print("Salary :", emp[0]) print("Allowance :",
emp[1]) print("Deductions :", emp[2])
else:
print("Employee not
found!") employees = empdata()
while True:
print("""Operations Menu :-
1. Display the total salary.
2. Display total allowance and deductions.
3. Search for an employee. 4. Exit""") ch = int(input("Enter your choice = "))
if ch == 1:
totalsalary(employees)
elif ch == 2:
allowancededuction(employees)
elif ch == 3:
search(employees)
elif ch == 4: break
else: print("Invalid
choice!")