Why output is False? | SoloLearn: Learn to code for FREE!


Why output is False?

a=9**19==(int(float(9**19))) print(int(a)) #output = 0 but why can anyone explain it.

8/18/2018 4:40:26 PM

Maninder $ingh

6 Answers

New Answer


Apparently some digits are being truncated when you do int(float()) casting. Run in a Python shell to see the difference.


You can't assign value to variable and compare it at once. What do you think what 'a' is? 9**19 or boolean


I believe it has to do with the float function and how floats are handled in Python. https://docs.python.org/2/tutorial/floatingpoint.html


try this a=9**19 print(int(a)) b=int((float(9**19))) print(b) You will see the difference


a=int(9**19) print(a) #outputs 1350851717672992089 a=int(float(9**19)) print(a) #outputs 1350851717672992000 It seems that either "float" or "int" has some issues with python.


Just because of different estimations by compiler.