+ 1
Please, help me understand this: print(not(2==3 or 2==3 and 2==3)) ==>True print(not(2==2 or 2==2 and 2==3)) ==>False should I operate 'and ' before 'or'? or simply operate from left to right? it's spinning my head please!
Confused on Precedence Operation.
5 Réponses
+ 11
Step1=(2==3 and 2==3) =(false and false)=false
Step2=(2==3 or false)=(false or false) =false
Step3=(not false)=true
Step1= (2==2 and 2==3) =(true and false)=false
Step2=(2==2 or false)=(true or false) =true
Step3=(not true)=false
+ 8
" And" is performed before "or" the same way multiplication is performed before addition unless brackets specify otherwise. Think of it as math.
0
first right to left
0
go with precedence rule...!! it's easy enough
0
AND
OR
NOT