Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Filing And Computer Database Projects

Authors: Jeffrey Stewart

2nd Edition

007822781X, 9780078227813

More Books

Students also viewed these Databases questions

Question

Discuss the key people management challenges that Dorian faced.

Answered: 1 week ago

Question

How fast should bidder managers move into the target?

Answered: 1 week ago