Skip to content

Instantly share code, notes, and snippets.

@zcakzwa
Created July 5, 2016 05:01
Show Gist options
  • Save zcakzwa/c52cf06d35c0748f61f48ec985ddb07a to your computer and use it in GitHub Desktop.
Save zcakzwa/c52cf06d35c0748f61f48ec985ddb07a 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 raw_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 v…
hrs = raw_input("Enter Hours:")
h = float(hrs)
rate = raw_input("Enter Rates:")
r = float(rate)
def computepay(h,r):
if h > 40:
payoff = 40*r +(h-40)*1.5*r
else:
payoff = h*r
return payoff
p = computepay(h,r)
print p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment