Created
August 16, 2015 04:19
-
-
Save KKarthikeya/0696fe56a97c0699c3c5 to your computer and use it in GitHub Desktop.
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 valu…
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(hours,rate): | |
if hours>40.0: | |
p = rate * 40.0 | |
p = p+(1.5*rate*(hours-40)) | |
else: | |
p = rate*hours | |
return p | |
hours = float(raw_input("Enter worked hours: ")) | |
rate = float(raw_input("Enter Pay rate per hour: ")) | |
print computepay(hours,rate) |
def computepay(h,r):
if h>40.0:
p = r * 40.0
p = p+(1.5r(h-40))
else:
p = r*h
return p
h = float(input("Enter Hours:"))
r = float(input("Enter rate:"))
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
Thanks!!!!!!! a tonnnnn it really worked