0
Can someone explain this question acc operator ranks and why its answer is what it is!
x=4 y=2 if not 1+1 == y OR x==4 and 7==8: Print("yes") elif x>y: Print("No")
5 Réponses
+ 1
When the condition evaluates to False the code block nested into condition is skipped
+ 1
if not True or True and False
if False or True and False
if False or False
False
not>and>or
+ 1
There is the analogy. OR is logical addition, AND is logical multiplication. So as in algebra there multiplication (AND) goes before addition(OR).
Let's evaluate this condition
NOT(1+1 == y) OR (x==4 AND 7==8)
We could replace truly expressions with ones, falsy with zero
NOT(1) + 1 * 0
NOT just inverts value from 1 to 0 and vice versa
0 + 1*0=0
So result is 0(False)
0
So 3rd line's condition is False but there is no condition in it , that's like
False:
Print (" yes")
How is its answer No?
0
aaah thankyou so much stephen and Lily!!!!