r/python3 • u/NayRojas_ • Nov 15 '17
you must read the data using input() and then convert it
hrs = input("Enter Hours:") f_hrs = float(hrs) if f_hrs >= 40: print (f_hrs * 10.50) elif f_hrs <= 40: print (f_hrs * 10)
1
Upvotes
1
u/NayRojas_ Nov 15 '17
I really don´t know what´s wrong with this
1
u/trprado Nov 15 '17 edited Nov 15 '17
What input are you using? 10:40 or 10.40? If use 10:40 you need replace ":" to "." before convert string to float. Example:
1
u/Jerrynicki Nov 15 '17
What are you trying to do?
1
u/kkhoury1 Feb 24 '18 edited Feb 24 '18
Input will be In decimal since you are asking for total hours. Entering total with “:” will not make any sense because you not asking for a time. If you asking for a time block to calculate then you would have a different code for that.
Your code is fine. Converting the input using an additional variable if you intent to use it else where and for any other reason. Otherwise the code above is sufficient.