+ 3

How operator precedence work in Python? I found in many comments that it is and or not and in the table it shows "not and or"

https://code.sololearn.com/ce2FlisnyhXw/?ref=app

29th Oct 2019, 3:18 AM
Ashutosh Joshi
6 Respuestas
+ 3
Ashutosh Joshi Your code comments match my understanding of the operator precedence.
29th Oct 2019, 9:09 AM
David Carroll
David Carroll - avatar
+ 8
Highest to lowest precedence: + == not and or https://docs.python.org/3/reference/expressions.html#operator-precedence
29th Oct 2019, 3:52 AM
Diego
Diego - avatar
+ 8
I also had doubt in it thank you for explaining.
30th Oct 2019, 10:21 AM
Rimjhim
Rimjhim - avatar
29th Oct 2019, 9:23 AM
David Ashton
David Ashton - avatar
+ 3
I tried to evaluate using not>and>or and it works. I have mentioned it in the code as comment. Need to confirm whether I understood it properly or not. Thanks😀
29th Oct 2019, 3:20 AM
Ashutosh Joshi
+ 3
Interesting! I tend to just use parentheses for clarity and to avoid this mess.
30th Oct 2019, 11:55 AM
Rora