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 updsalaryemployees:
empid inputEnter the employee ID:
newsal inputEnter the new salary of the employee:
found False
for i in rangeemployees:
if employeesi empid:
found True
employeesi newsal
writeemployeesemployees
break
b
def updsalaryemployees:
empid inputEnter the employee ID:
newsal inputEnter the new salary of the employee:
found False
for i in rangelenemployees:
if employeesi empid:
found True
employeesi newsal
writeemployeesemployees
break
c
def updsalaryemployees:
empid inputEnter the employee ID:
newsal inputEnter the new salary of the employee:
found False
for i in rangelenemployees:
if employeesi empid:
found True
employeesi newsal
writeemployeesemployees
break
d
def updsalaryemployees:
empid inputEnter the employee ID:
newsal inputEnter the new salary of the employee:
found False
for i in rangeemployees:
if employeesi newsal:
found True
employeesi empid
writeemployeesemployees
break
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
