Skip to content

Instantly share code, notes, and snippets.

@Mohamed2del
Created June 9, 2018 15:10
Show Gist options
  • Save Mohamed2del/8d8f0b21056b99a48ca0bf5260465b84 to your computer and use it in GitHub Desktop.
Save Mohamed2del/8d8f0b21056b99a48ca0bf5260465b84 to your computer and use it in GitHub Desktop.
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. U…
def computepay(h,r):
x=0
if h > 40.0:
x = r * 40.0 +(1.5*r*(h-40.0))
elif h <= 40 :
x= h*r
return x
hrs = float(input("Enter Hours:"))
rate = float(raw_input("Enter the rate:"))
p = computepay(hrs,rate)
print(p)
@momocalderon
Copy link

Sharp coding

@omarakl
Copy link

omarakl commented Nov 8, 2020

def computepay(h,r):
x=0
if h > 40.0:
x = r * 40.0 +(1.5r(h-40.0))
elif h <= 40 :
x= h*r
return x

hours = float(input("Enter Hours:"))
rate = float(raw_input("Enter the rate:"))
p = computepay(hours,rate)
print("Pay",p) # you need to add "Pay" here

#Good Coding Bro

@ahmetyilmaz19232023
Copy link

Good Code Thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment