Created
June 9, 2018 15:10
-
-
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…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Good Code Thx