Why error... Tell mistake or correct plz | SoloLearn: Learn to code for FREE!


Why error... Tell mistake or correct plz

if num = 0.4: print("num")

8/3/2019 12:32:52 PM

Ateex Taseer

6 Answers

New Answer


To compare equality you use "==". "=" is a purely assignment operator and for simplicity sake, if you use assignment as a value you get errors.


"=" assigns a value "==" will check conditions.


The mistake is from the definition of your variable. Your number has decimal point, so you have to define it properly with the "double" Try: if (double num ==0.4); print(num)


if num == 0.4: print("num")


if "num" == 0.4: print("num") I rewrite it as this๐Ÿ‘†๐Ÿ‘† Still No output What should I do to get an output Concept?


What exactly do you need to do?