Random Python Questions #4

0.1 + 0.4 == 0.5

The above is ‘True’, using Python script execution, right?

Of course, yes.

But if you try in Python script

0.1 + 0.2 == 0.3

this will return ‘False‘. It supposed to return ‘True’ but why it gives ‘False’. Why?

Do you know some of the above == return ‘False’ instead of ‘True’ ?

Why?

Leave a comment

Design a site like this with WordPress.com
Get started