+ 1
Can you help me?
Why the compiler output this??? I am not understand,this is wrong!!!!! https://sololearn.com/compiler-playground/crypqhNsbh2o/?ref=app
2 odpowiedzi
+ 5
A little explanation on StuartH's answer.
1==0 >= False
becomes
1==0 and 0 >= False
becomes
False and True
which is False.
1!=2 >= False
becomes
1 != 2 and 2 >= False
becomes
True and True
which is True.
In Python, 1 == True, 0 == False.
+ 3
As I understand it, Python will split out chained comparisons as follows:
1==0 >= False
becomes
1==0 and 0 >= False
which is False.
1!=2 >= False
becomes
1 != 2 and 2 >= False
which is True.