Python operators

From wikinotes

Operators

if ( x = 1 ) :             #regular if statement
if (not( x =1 )) :         #if not statement
if (x = 1) and (y=2) :     #if and statement
if (x > 10) and (x < 20) : #if or statement

bitwise operators

x | y      // bitwise or
x ^ y      // bitwise exclusive and
x & y      // bitwise and
x << n     // bitwise shift by n bits
x >> n     // bitwise shift by n bits
~x         // invert bits