Bitwise operators work on the individual binary digits (bits) of integers rather than on their overall values. They only accept integers, including Booleans, which are integers; using them on floats raises TypeError. You will meet them in low-level work such as flags, permissions and network masks, and the exam checks that you can compute them by hand. Think of each number as a row of switches, and each operator as a rule for combining the switches column by column.
Keep reading for free
Create a free StudyToCert account to read the rest of this lesson: 7 more sections, 6 key terms, a real-world example, an exam tip and self-check questions. Every lesson, lab and practice test is free with an account.