Priority of the logical statements NOT AND & OR in python -
as far know, in c & c++, priority sequence not , & or not>and>or. doesn't seem work in similar way in python. tried searching in python documentation , failed (guess i'm little impatient.). can clear me?
it's not, and, or, highest lowest according documentation https://docs.python.org/3/reference/expressions.html#operator-precedence
here complete precedence table, lowest precedence highest. row has same precedence , chains left right
- lambda
- if – else
- or
- and
- not x
- in, not in, is, not, <, <=, >, >=, !=, ==
- |
- ^
- &
- <<, >>
- +, -
- *, /, //, %
- +x, -x, ~x
- **
- x[index], x[index:index], x(arguments...), x.attribute
- (expressions...), [expressions...], {key: value...}, {expressions...}
edit: had wrong precedence
Comments
Post a Comment