Question: For the Employee Class Program in the Unit 3 Finishing the Employee Class Program tutorial, what if we need to search through the list of

For the Employee Class Program in the Unit 3 Finishing the Employee Class Program tutorial, what if we need to search through the list of employees to find a specific one, change their id, and save this information back in the employees.csv file? What code segment implements this in a method?
def upd_id(employees):
empid = input("Enter the employee ID: ")
new_id = input("Enter the new id of the employee: ")
found = False
i =0
for i in range(0,len(employees)):
if employees[i][0]== empid:
found = True
employees[i][0]= new_id
write_employees(employees)
break
def upd_id(employees):
empid = input("Enter the employee ID: ")
new_id = input("Enter the new id of the employee: ")
found = False
i =0
for i in range(0,employees):
if employees[i][0]== new_id:
found = True
employees[i][0]= empid
write_employees(employees)
break
def upd_id(employees):
empid = input("Enter the employee ID: ")
new_id = input("Enter the new id of the employee: ")
found = False
i =0
for i in range(0,employees):
if employees[i][0]== empid:
found = True
employees[i][0]= new_id
write_employees(employees)
break
def upd_id(employees):
empid = input("Enter the employee ID: ")
new_id = input("Enter the new id of the employee: ")
found = False
i =0
for i in range(0,len(employees)):
if employees[0][i]== empid:
found = True
employees[0][i]= new_id
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!