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

  1. lambda
  2. if – else
  3. or
  4. and
  5. not x
  6. in, not in, is, not, <, <=, >, >=, !=, ==
  7. |
  8. ^
  9. &
  10. <<, >>
  11. +, -
  12. *, /, //, %
  13. +x, -x, ~x
  14. **
  15. x[index], x[index:index], x(arguments...), x.attribute
  16. (expressions...), [expressions...], {key: value...}, {expressions...}

edit: had wrong precedence


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

php - Dynamic url re-writing using htaccess -

java - Multi-Label Document Classification -