+ 1
What is the result of this code?
x = 4 y = 2 if not 1 + 1 == y or x == 4 and 7 == 8: print("Yes") elif x > y: print("No") Can someone explain? I got the right answer but only after second try. Don't really get why..
2 odpowiedzi
+ 2
if not 1+1 == y is False because of not
,go next. or x == 4 (True for now) and 7 == 8 (False, so it's False). The if is falsey and that's why elif (True) gets printed.
+ 1
The code is ok
It will be print the: No
The elif case is so clear
And in if case first it checks (not 1+1==y) that its false but we have another condition that is true (x==4) buy mixture by (7==8) that makes it false again...
So thus we have exactly two condition that both are false and the if condition doesnt work