Question: For Python 3 Add functions and include lists. Write a function called get_input() that takes no arguments and returns the name, hours worked, and hourly

For Python 3

Add functions and include lists.

Write a function called get_input() that takes no arguments and returns the name, hours worked, and hourly rate for one employee. The body of the function will include the prompts and store the user input.

Write a function called calc_pay(hours, rate) that takes two arguments and returns the amount the employee gets paid for the week. The body will include the calculation.

Use a list to store the paycheck values for the employees entered. Iterate through the list to calculate the total and average of all employees entered

to the following code:

employ = int(input("How many employees do you want to enter?")) print(" ") tot = 0 for i in range(employ): name = input("Enter a name: ") hours = float(input("Enter hours worked:")) rate = float(input("Enter hourly rate:")) pay = 0 if hours > 40: pay = (40 * rate) + ((hours -40) * 1.5 * rate) else: pay = hours * rate tot += pay print("{} should be paid ${:,.2f}".format(name, pay)) print(" ") print("The total amount to be paid is ${:,.2f}".format(tot)) print("The average employee is paid ${:,.2f}".format(tot/employ))

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!