Why False | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why False

Why 0.1+0.2==0.3 Output is false

16th Jun 2020, 2:45 PM
Mohammad
Mohammad - avatar
2 Answers
+ 3
Because 0.1 +0.2 = 0.300000004 != 0.3
16th Jun 2020, 2:58 PM
Abhay
Abhay - avatar
0
Try this for comparision upto 2 decimal places, print(round(0.1+0.2,2)==0.3)
16th Jun 2020, 3:03 PM
$ยข๐Žโ‚น๐”ญ!๐จ๐“
$ยข๐Žโ‚น๐”ญ!๐จ๐“ - avatar