+ 4
Please tell why the output is False?????
7 Respuestas
+ 6
True!=0==True
... is evaluated like this:
True!=0 and 0==True
Since 0 doesn't equal True, you get False.
+ 6
I don't know about python but hope this may help you, python visualizer.
http://www.pythontutor.com/visualize.html#mode=edit
+ 5
Thanks HonFu ☺️☺️☺️
+ 4
I evaluated it as (True!=0)==True
+ 4
Yeah, that's how many other languages would do it.
Python goes its own way in that respect, so you can for example write stuff like:
if 3<x<10:
Which means that x is between 4 and 9.
+ 2
print(True!=0==True)
Dear,
two statements are there
1--- True!=0 (Which Is true)
2--- 0==True (Which is False)
Now Results here
True==False (Result will be False)
run...
False
I think now you can understand better
0
Python is a multithreaded language and in this particular case it is comparing 0 from both LHS and RHS simultaneously giving true from LHS and false from RHS which now we have True and False which gives False..