
Linda M.
asked 12/05/20python question
Write a python program using a function to prompt the user for hours and rate per hour to compute gross pay. Pay should be the normal rate for hours up to 40 and two times for the hourly rate for all hours worked above 40 hours. To do the pay computation, create a function called paycalculator that takes user-entered hour and rate as its parameters and returns the total pay as a string.
1 Expert Answer

Patrick B. answered 12/05/20
Math and computer tutor/teacher
# Online Python compiler (interpreter) to run Python online.
# Write Python 3 code in this online editor and run it.
print("Hello world")
def payCalculator(hours, wage):
if float(hours)>40:
OT_salary = (float(hours)-40)*float(wage)*2
salary = 40*float(wage)
else:
salary = float(hours)*float(wage)
OT_salary=0
return(float(OT_salary)+float(salary))
hoursWorked = input("Please Input the # of hours worked :>")
wage = input("Please input the hourly wage :>")
print(" The total salary is " + str(payCalculator(hoursWorked,wage)))
Still looking for help? Get the right answer, fast.
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.
Patrick B.
source code uploaded to RESOURCES section12/05/20