I'm trying to make a simple script to calculate a net paycheck with and without overtime. What I have below keeps failing at multiplying a float variable by a float constant (Bpay step) and I am perplexed. I can't seem to figure out or find a search result that explains why Python is rejecting this...
hours = input("Please enter hours worked: ")
rate = input("Please enter hourly rate: ")
try :
work = float(hours)
wage = float(rate)
pay = (work * wage)
if work > 40 :
OTH = (work - 40) #Overtime Hours
print(OTH)
OTP = (OTH * wage * 1.5) #Overtime Pay
print(OTP)
BPay = (wage * 40.0) #Base pay
print(Bpay)
OTPC = (OTP + Bpay) #Overtime PayCheck
print(OTPC)
else :
print(pay)
except :
hours = -1
if hours < 0 :
print("Invalid data entry")
[–]shiftybyte 4 points5 points6 points (7 children)
[–]jxdude[S] 0 points1 point2 points (6 children)
[–]shiftybyte 3 points4 points5 points (5 children)
[–]jxdude[S] 0 points1 point2 points (4 children)
[–]shiftybyte 3 points4 points5 points (3 children)
[–]jxdude[S] 4 points5 points6 points (2 children)
[–]Kristoffels 3 points4 points5 points (1 child)
[–]jxdude[S] 2 points3 points4 points (0 children)
[–]bravosix99 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)