+ 1
Why error... Tell mistake or correct plz
if num = 0.4: print("num")
6 odpowiedzi
+ 9
To compare equality you use "==". "=" is a purely assignment operator and for simplicity sake, if you use assignment as a value you get errors.
+ 9
"=" assigns a value
"==" will check conditions.
+ 4
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)
+ 1
if num == 0.4:
print("num")
0
if "num" == 0.4:
print("num")
I rewrite it as this👆👆
Still No output
What should I do to get an output
Concept?
0
What exactly do you need to do?