Created
March 29, 2019 16:50
-
-
Save ZeroRaven/6c82f2c8e2a2dc327f42c9fe858da3c3 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. Pay should be the normal rate for hours up to 40 and time-and-a-half for the hourly rate for all hours worked above 40 hours. Put the logic to do the computation of pay in a function called computepay() and use the function to do the computation…
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): | |
if h > 40: | |
p = 1.5 * r * (h - 40) + (40 *r) | |
else: | |
p = h * r | |
return p | |
hrs = input("Enter Hours:") | |
hr = float(hrs) | |
rphrs = input("Enter rate per hour:") | |
rphr = float(rphrs) | |
p = computepay(hr,rphr) | |
print(p) |
PRINCE9966
commented
Jun 18, 2024
via email
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AK5MVHM3HKIY46POWYMRHSTYYGLNNBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVA4TKNBUGA4DINNHORZGSZ3HMVZKMY3SMVQXIZI>
.
…On Thu, May 30, 2024 at 11:58 PM FardadF4 ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
can check this:
def computepay(h,r):
if h > 40:
p = 1.5 * r * (h - 40) + (40 *r)
else:
p = h * r
return p
hrs = input("Enter Hours:")
hr = float(hrs)
rphrs = input("Enter rate per hour:")
rphr = float(rphrs)
p = computepay(hr,rphr)
print("Pay", p)
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/ZeroRaven/6c82f2c8e2a2dc327f42c9fe858da3c3#gistcomment-5073892>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AK5MVHJYPN6Y54YRN3EMZLTZE5VTNBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVA4TKNBUGA4DINNHORZGSZ3HMVZKMY3SMVQXIZI>
.
You are receiving this email because you are subscribed to this thread.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
def computepay(h, r):
if h > 40:
p = 0.5 * r * (h - 40 ) + (h * r)
else:
h = h * r
return p
hrs = input("Enter Hours:")
Rate = input("Enter Rate:")
h = float(hrs)
r = float(Rate)
p = computepay(h, r)
print("Pay:", p)
good
ni ce
good
hrs = input("Enter Hours:")
h = float(hrs)
rate = input("Enter Rate:")
r = float(rate)
h2 = h-40
r2 = 1.5*r
h3 = h-h2
def computepay(h, r):
if h <= 40 : return (hr)
else : return (h2r2+h3*r)
p = computepay (h, r)
print("Pay", p)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment