"""Mr.
Ravi, a manager at a tech company, needs to maintain records of
employees. Each
record should include: Employee_ID, Employee_Name, Department and Salary.
Write the Python functions to:
I.
Input employee data and append it to a binary file.
II. Update the salary of employees in the "IT" department to 200000.
"""
import pickle
def append_data():
with open("[Link]", 'ab') as file:
employee_id = int(input("Enter Employee ID: "))
employee_name = input("Enter Employee Name: ")
department = input("Enter Department: ")
salary = float(input("Enter Salary: "))
[Link]([employee_id, employee_name, department, salary], file)
print("Employee data appended successfully.")
#[Link]()
append_data()
f = open('[Link]', 'rb')
bin = [Link]()
print(bin)
[Link]()
def update_data():
updated = False
employees = []
with open("[Link]", 'rb') as file:
try:
while True:
employee = [Link](file)
if employee[2] == "IT":
employee[3] = 200000
updated = True
[Link](employee)
except EOFError:
pass
with open("[Link]", 'wb') as file:
for employee in employees:
[Link](employee, file)
if updated:
print("Salaries updated for IT department.")
else:
print("No employee found in the IT department.")
#[Link]()
update_data()