Nlogk
Cheat Sheet

Operators Priority

Python Operators and Expressions

Python Expressions Documentation

CategoryOperatorsDescription
Parentheses()Grouping expressions
Exponentiation**Power operation
Unary Operators+x, -x, ~xPositive, negative, bitwise NOT
Arithmetic*, /, //, %, +, -Multiplication, division, floor division, modulo, addition, subtraction
Bitwise Shift>>, <<Right shift, left shift
Bitwise Operations&, ^, |AND, XOR, OR
Comparisons>, >=, <, <=, ==, !=Greater than, greater or equal, less than, less or equal, equal to, not equal
Logical Operationsand, or, notLogical AND, OR, NOT
Assignment=, +=, -=, *=, /=, %=, **=, //=Simple and augmented assignments
Identityis, is notObject identity comparison
Membershipin, not inCollection membership test

Notes

  • Python doesn't have increment ++ or decrement -- operators
  • Python uses and, or, not instead of &&, ||, !
  • The // operator performs floor division
  • The is operator checks if two objects share the same memory location
  • Chained comparisons like a < b < c are allowed