python hw I need to be able to take a list and come up with multipe outputs with def functions

code is in file and I can also inclde the note that ame with it to use fr calculations

Get Help With a similar task to - python hw I need to be able to take a list and come up with multipe outputs with def functions

Login to view and/or buy answers.. or post an answer
Additional Instructions:

#List of Employees employee_names= [] #List of hourly wages hourly_wages=[] #Total hours worked to calculate pay total_hours=[] #Menu for user to select a letter def menu(): while True: print('Menu of choices:') print('\t(r)read employee data') print('\t(p)rint employee payroll') print('\t(d)isplay an employee payroll') print('\tfind (h)igest paid employee') print('\tfind (l)owest paid employee') print('\t(q)uit') #users choice letter option=input('Please enter your choice: ').lower() if option=='r' or option=='p' or option=='d' or option=='h' or option=='l' or option=='q': break else: print(f'Invalid choice. Try again') return option #reading incoming file data def employeedata(file): try: with open(file, "r") as f: f_data=f.readlines() for line in file: finalPayroll = line.split() totalHours = 0 employee_names.append(f_data[0]) hourly_wages.append(f_data[1]) total_hours.append(f_data[2]) for i in range(1,6): total_hours = total_hours + float(finalPayroll[i]) hoursWorked.append(totalHours) print ("File has been read") #error telling user they did not put in a correct ile except FileNotFoundError: print(f'Error reading file {file}') #Printing of employee payroll def empPay(): if not employee_names: print(f'Employee data has not been read') print(f'Please read the file') else: emp_pay=0 print('\tName\tHours\tPay') print('------------------') for i in range(0,len(employee_names)): week_pay=total_hours[i]*hourly_wages[i] print((employee_names[i]),'\t',(total_hours[i]),'\t',(week_pay[i])) company_pay=company_pay+week_pay print('Total Payroll=$',(company_pay)) #Information about one employees name hours and payroll def employee(employee): if not employee_names: print(f'Employee data has not been read') print(f'Please read the file') else: if employee==employee_names[i]: salary=hourly_wage[i]*total_hours[i] print(employee_name[i],'works',(total_hours),'hours at $',(hourly_wage),'per hour and earned $',(salary)) #Highest Paid employee def maxEmp(max): if not employee_name: print(f'Employee data has not been read') print(f'Please read the file') else: if max=='h': highEmployee=' ' highWage=(hourly_wage[0])*(total_hours) for i in range(0,len(employee_names)): salary=hourly_wage[i]*total_hours[i] if salary>=highWage: highEmployee=employee_names[i] highSalary=salary print((highEmployee),'made $',(highSalary)) #Lowest paid employee def minEmp(min): if not employee_name: print(f'Employee data has not been read') print(f'Please read the file') else: if min=='l': lowEmployee=' ' lowWage=(hourly_wage[0])*(total_hours) for i in range(0,len(employee_names)): salary=hourly_wage[i]*total_hours[i] if salary>=highWage: lowEmployee=employee_names[i] lowSalary=salary print((lowEmployee),'made $',(lowSalary)) #Calling the main function def main(): while True: choice=menu() if choice=='r': empFile=input('Enter the file name: ') if not empFile.lower().endswith('txt'): empfile+='.txt' print(employeedata(empFile)) elif choice=='p': print(empPay()) elif choice=='d': employee=input('Enter employees name: ') employee(employee) elif choice=='h': maxEmp(max) elif choice=='l': minEmp(min) elif choice=='q': print(f'Goodbye.') exit() main()

Name Wage M T W R F Jolie 16 9 8 8 7.5 6 Heughan 22 9 12 3 5 14 Smith 10 8 8 8 8 10 Jones 12.50 4 7 5 3.3 2.2 Balfe 25 7 6.5 9 8 8 Miller 20 6.5 9 1 1 1 Baker 15 7.5 9 4 0 2 Ahmad 11.50 4.5 9 7 3 2 Menzies 7 5 5 7 9 8 Choi 7.50 20 20 2.5 4 4 Moore 12 4 6 8 4 4 Johnson 13.25 8 8 7 5 9

Related Questions

Similar orders to python hw I need to be able to take a list and come up with multipe outputs with def functions
9
Views
0
Answers
apply relevant programming concepts to develop a simple application using the Python programming language.
I need the assignment to be done according to the specifications laid out. No pandas coding please. I have attached the specifications to be done in accordance. I currently am working on jupyter notebook for this codes...
22
Views
0
Answers
Python: Use object-oriented programming and Numpy techniques to create simple graphics with bullseyes
Create a class Canvas, and implement two methods. The __init__() method should take two arguments other than self, background and n. The background is expected to be a 1d Numpy array of length 3, representing an RGB color. For example, black = np.array([...
34
Views
0
Answers
IVP, Euler and Taylor Methods python programming
TOPIC 1: Initial Value Problem • MIT Lecture notes: https://bit.ly/3dDvsSh • ODEs: Introduction to Ordinary Differential Equations: https://bit.ly/3qUadPO TOPIC 2: Euler Method • MIT Lecture notes: https://bit.ly/3dDvsSh • Euler Method: http...
29
Views
0
Answers
Using a simple menu containing: Linear search, binary search, bubble sort, add item, delete item and quit/log out
My subject is programming: python. using the menu containing: Linear search, binary search, bubble sort, add item, delete item and quit/log out i need to Define & Document Technical Requirements, Algorithm Design, Design Review, coding, testing and debug...