Skip to content

Instantly share code, notes, and snippets.

@MichelleDalalJian
Created October 7, 2017 12:43
Show Gist options
  • Save MichelleDalalJian/c31a1dc1454a89a57bac921aa23f0046 to your computer and use it in GitHub Desktop.
Save MichelleDalalJian/c31a1dc1454a89a57bac921aa23f0046 to your computer and use it in GitHub Desktop.
4.6 Write a program to prompt the user for hours and rate per hour using input to compute gross pay. Award time-and-a-half for the hourly rate for all hours worked above 40 hours. Put the logic to do the computation of time-and-a-half in a function called computepay() and use the function to do the computation. The function should return a value…
def computepay(hours, rate):
xh=float(hours)
xr=float(rate)
if xh < 40:
pay = xh*xr
return pay
else:
pay=(xr*40)+(xh-40)*(xr*1.50)
return pay
xh = input("Enter Hours:")
xr = input ("Enter Rate:")
print(computepay(xh,xr))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment