+ 1

Why error... Tell mistake or correct plz

if num = 0.4: print("num")

3rd Aug 2019, 12:32 PM
Ateex Taseer
Ateex Taseer - avatar
6 Réponses
+ 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.
3rd Aug 2019, 12:41 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 9
"=" assigns a value "==" will check conditions.
3rd Aug 2019, 4:06 PM
Rajnish Kush
Rajnish Kush - avatar
+ 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)
3rd Aug 2019, 3:57 PM
George Henry
George Henry - avatar
+ 1
if num == 0.4: print("num")
3rd Aug 2019, 2:55 PM
Young Seven
Young Seven - avatar
0
if "num" == 0.4: print("num") I rewrite it as this👆👆 Still No output What should I do to get an output Concept?
3rd Aug 2019, 2:12 PM
Ateex Taseer
Ateex Taseer - avatar
0
What exactly do you need to do?
3rd Aug 2019, 6:00 PM
Makoye Ndalahwa
Makoye Ndalahwa - avatar