How is this expression evaluated false in python?

a = 9 ** 19 == int(float(9 ** 19)) print(a) How is value of a is false. Plz help

9/20/2019 1:55:12 PM

Devarsh Mavani

1 Answer

New Answer


The two numbers 9 ** 19 and int(float(9 ** 19)) apparently are two different values. I presume this was due to the conversion to int from float, which reduces/changes the precision of the decimal point. You can easily verify this by printing the two values as follows: print(9 ** 19, int(float(9 ** 19))) There you'll see they are different, and as such checking them for equality yields false, which then be stored into variable <a>. Hth, cmiiw