Question: For the Employee Class Program in this tutorial, what if we need to search through the list of employees to find a specific one, update

For the Employee Class Program in this tutorial, what if we need to search through the list of employees to find a specific one, update the salary in it, and save this information back in the employees.csv file? What code segment implements this in a method?
a.)
def upd_salary(employees):
empid = input("Enter the employee ID: ")
new_sal = input("Enter the new salary of the employee: ")
found = False
for i in range(0,employees):
if employees[i][0]== empid:
found = True
employees[i][1]= new_sal
write_employees(employees)
break
b.)
def upd_salary(employees):
empid = input("Enter the employee ID: ")
new_sal = input("Enter the new salary of the employee: ")
found = False
for i in range(0,len(employees)):
if employees[0][i]== empid:
found = True
employees[1][i]= new_sal
write_employees(employees)
break
c.)
def upd_salary(employees):
empid = input("Enter the employee ID: ")
new_sal = input("Enter the new salary of the employee: ")
found = False
for i in range(0,len(employees)):
if employees[i][0]== empid:
found = True
employees[i][1]= new_sal
write_employees(employees)
break
d.)
def upd_salary(employees):
empid = input("Enter the employee ID: ")
new_sal = input("Enter the new salary of the employee: ")
found = False
for i in range(0,employees):
if employees[i][0]== new_sal:
found = True
employees[i][1]= empid
write_employees(employees)
break

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!