Glossary: Algorithms Beyond the Basics
Bit operators
Also written: bitwise operators, &, |, ^, ~, <<, >>, Shift left / shift right, <<, \>>, shift
Python operators that work on the bits of whole numbers one column at a time: `&` (and), `|` (or), `^` (XOR), `~` (not), and the shifts `<<` and `>>`. Each left shift doubles a number (`5 << 3` is 40, and `1 << n` is 2ⁿ) and each right shift halves it.