How can I interpret "if not 1+1 ==y or x==4 and 7==8" | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I interpret "if not 1+1 ==y or x==4 and 7==8"

How can I interpret "if not 1+1 ==y or x==4 and 7==8" - doesn't it mean that if either of "1+1==y" and "x==4 and 7==8" is false?

4th Jan 2017, 8:54 AM
JAEYEON LEE
JAEYEON LEE - avatar
2 Answers
+ 6
No, they should be in parenthesis to do that. ("not" changes only the first statement) Simplified: if 1+1!=y or x==4 and false => if 1+1!=y => if y!=2==true
4th Jan 2017, 8:57 AM
Valen.H. ~
Valen.H. ~ - avatar
+ 5
this is the explanation: x = 4 y = 7 not 1+1 ==y or x==4 and 7==8 so lets elaborate, (not 1+1==y ) //--> not 2 == 7 //--> not false // TRUE <-- answer on the first problem => (X == 4) //--> 4 == 4 //--> TRUE <-- answer on the second problem => (7==8) //--> FALSE <-- answer on the third problem lets combine all. (TRUE or TRUE) and FALSE //--> TRUE or TRUE is TRUE => TRUE and FALSE is FALSE so the answer is False,
17th Jan 2017, 12:44 PM
Darwin Fegarido
Darwin Fegarido - avatar