Apr-27-2020, 05:43 PM
Hello all
I see that a working codehas already been posted but I'm trying to resist just copying somebody else's work. However, I'm getting a headache staring at this now!
I'm a total beginner, admittedly but it's frustrating me that I'm getting stumped so early on in this course.
With the below code, I'm not getting any errors, it's a perfectly good, working code.
The issue is that I should be able to input:
Hours 45 (sth)
Rate 10.50 (str)
...and come out with an answer of 498.75
My code is coming up with 551.25 !
I'm sure it's something really simply that I'm overlooking because I've been staring for too long but can anyone spot it?
I see that a working codehas already been posted but I'm trying to resist just copying somebody else's work. However, I'm getting a headache staring at this now!
I'm a total beginner, admittedly but it's frustrating me that I'm getting stumped so early on in this course.
With the below code, I'm not getting any errors, it's a perfectly good, working code.
The issue is that I should be able to input:
Hours 45 (sth)
Rate 10.50 (str)
...and come out with an answer of 498.75
My code is coming up with 551.25 !
I'm sure it's something really simply that I'm overlooking because I've been staring for too long but can anyone spot it?
sth = input("Enter hours: ") str = input("Enter rate: ") flh = float(sth) flr = float(str) if flh > 40 : reg = flr * flh ot = (flh - 40.0) * (flr * 1.5) pay = reg + ot else: pay = flh * flr print (pay)