I am new to Python. I have two simple questions. In my code, I need to do something like the following:
50-49.9==0.1
but python is giving False. How can I correct this? Also, a similar wrong result I am getting is in the following:
int(10*(1-0.9))
I want the answer to be 1 but I am getting 0.
(1-0.9)results in0soint(10*0)will result in050-49.9 == 0.1. The result is not always 0.1 unless you giveround(x,1)so it rounds to 1 decimal place