Python Forum

Full Version: Problematic Assignment
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, I m stuck here, I dont know whats missing or whats wrong with it. Please, if anyoane have any suggestions, I literally cant continue. Thanks!
hrs = input("Enter Hours:")
h = float(hrs)
rate = input('Enter rate:')
r = float(rate)
if h<40:
    print (h * r)
elif h>40:
    r = r*float(1.5)
pay = h * r
print( pay)
The desire output is 498.75. The problem is thata I keep getting 708.75 and I have no idea why.
You have only provided the output. Kindly provide the input values for the rate and hours.

Also enter the code within the proper tags so that its readable. Click on the insert python option and place the code within this.
Please use proper code tags while coding, it is very difficult to understand your code otherwise. See BBCode for more info.
Also, please tell what have you tried, what are you supposed to do, what is the input you need to get your expected output, but what are you getting instead
Quote:You have only provided the output
@Pranav, no that is his code, not his output

(May-17-2020, 06:33 AM)EB22 Wrote: [ -> ]The desire output is 498.75. The problem is that I keep getting 708.75 and I have no idea why.

Well, it would be helpful if you showed us your full assignment
I agree with the above, but I think I see what is going on. You are applying the 1.5 overtime rate to the whole amount if the person goes over 40 hours, when you should only apply that to the excess over 40.

If I work 41 hours at $10 per hour, I should get 40*10 + 1*15, not 41*15.