I am trying to convert a string input to a float after the input is given. Leaving the option to do something with the input if it is a string. I have tried some things but they give back the following error:
"TypeError: can't multiply sequence by non-int of type 'float' on line 8"
Below is code that works, but I want to keep the input a string and convert to float after the input is given:
def computepay(h,r):
if h<=40:
return h*r
else:
return h*r+((h-40)*b)
h = float(input("Enter Hours:"))
r = float(input("Enter Rate:"))
b = 0.5*r
p = computepay(h,r)
print(p)
How would this be done correctly?
Thanks!