-
-
Save KKarthikeya/0696fe56a97c0699c3c5 to your computer and use it in GitHub Desktop.
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) |
Hello everyone!
Can someone plz help me with this problem? I am repeatedly getting the error with this code
Hi guys!!! here's my answear!! I hope it helps you...
def computepay(x,y):
if x>40:
sub = (x - 40) * 1.5
x = 40 + sub
pay = x * y
return pay
ux = input("Enter hour:")
uy = input("Enter rate:")
try:
x = float(ux)
y = float(uy)
except:
print("error,please enter numeric input")
quit()
h=computepay(x,y)
print("Pay",h)
Its not working....its shows error in 2nd line...plz help me ....that how I can solve it..
I am getting an error message "Invalid Syntax"
h=input("enter hours:")
x=float(h)
r=input("enter rate:")
y=float(r)
def computepay(x,y):
if x>40:
p=40y
p=p+(1.5y*(x-40))
else:
p=x*y
return p
print("Pay",computepay(x,y))
def computepay(h,r):
if(h>40):
return (40r)+((r1.5)(h-40))
else:
return hr
hrs = input("Enter Hours:")
rate=input("Enter Rate:")
print("Pay",computepay(float(hrs),float(rate)))
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)
working 100%
def salary (hours,rate):
if hours<=40:
p=hoursrate
return p
else:
p=(40rate)+((hours-40)1.5rate)
return p
hours=float(input('Enter Hours:'))
rate=float(input('Enter Rate:'))
pay = salary(hours,rate)
print(pay)
type mismatch ???????
Can you used your own editor to check the results before submitting the code.
As for me I worked fine.
You can also paste your code here so that you can get help
I'm stuck in assignments 4.6,, plz help me
@sourav091998
are you still needing help?
Im getting error in line 2 I have tried ur code
Can you post the error message here
And the question as well. Remember that some time questions are different from person to person
def computepay(h,r):
if h < 40:
Pay = h * r
else:
Pay = 40 * r + (h-40) * 1.5 * r
return Pay
hrs = input("Enter Hours:")
h = float(hrs)
rate = input("Enter Rate:")
r = float(rate)
Pay = computepay(h,r)
print("Pay", Pay)
It works!!!!!!!!!! please use this code~
@persphone997 why didn't you use the try except block?
@persphone997 why didn't you use the try except block?
Cause the original code he gave us is:
def computepay(h,r):
return 42.37
hrs = input("Enter Hours:")
p = computepay(10,20)
print("Pay",p)
So it definitely wants to improve on that.
But in the description did they ask you to use try except or not?
But in the description did they ask you to use try except or not?
For me.
Nope.
Okay then I hope they accepted your code right?
Well done
def computepay(hours,rate):
if hours>40.0:
p = rate * 40.0
p = p+(1.5rate(hours-40))
else:
p = rate*hours
return p
hours = float(raw_input("Enter worked hours: "))
rate = float(raw_input("Enter Pay rate per hour: "))
p=(computepay(hours,rate))
print("Pay",p)
This code is definitely gonna run on any platform.
Just try it once.
def computepay(h,r):
if h>40.0:
p=1.5 * float(r) * (h-40.0)+(40.0 * float(r))
else:
p=h*r
return p
hrs = input("enter hours:")
a=float (hrs)
rate = input("enter rate per hour:")
b=float(rate)
p=computepay(a,rate)
print("Pay",p)
help me my code is not running
solution without def
hrs = input("Enter Hours:")
h = float(hrs)
rate = input("Enter Pay Rate:")
r = float(rate)
pay = hr
otpay = 40r + (h-40)r1.5
if h<=40:
print(pay)
else:
print(otpay)
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)
Hello all! I should have updated you all on my progress. My apologies. I actually completed this assignment. Your help is greatly appreciated. :)