0

the sequence of this code if not 1 +1 ==y or x ==4 and 7 ==8

22nd Dec 2016, 4:07 PM
SealCLi
SealCLi - avatar
3 Respostas
+ 3
when you need to know precedence of logical operations, treat 'or' as '+', and 'and' as '*', and then apply the rules of common math. in logical math 'or' is also called 'logical addition', and 'and' is called 'logical multiplication' you can also use parentheses to set your own desired precedence
22nd Dec 2016, 5:31 PM
Demeth
Demeth - avatar
+ 2
What are the values of x and y. Here is the python reference for operator precedence. section 6.16 https://docs.python.org/3/reference/expressions.html#operator-precedence
22nd Dec 2016, 4:49 PM
Rishi Anand
Rishi Anand - avatar
+ 1
Inagine anf statements as having () sround them. Like 1+1==y or (x==y and x>6) or whatever. Ofer of operations says parenthesis are evaluated first. Just inagine they surround and statements abd its easier to visualize
29th Dec 2016, 6:38 PM
Ryan P
Ryan P - avatar