← All sections

Module 3 · Boolean values, conditional execution, loops, lists and list processing, logical and bitwise operations

Logic and bit operations

Combine conditions with and, or and not — then drop a level to the bits themselves, with the bitwise operators and shifts that work on individual 0s and 1s.

Begin lesson 1 →
  1. 1Logical operatorsCombine True/False answers with and, or and not.
  2. 2Logical values vs. single bitsWhole-value logic (and/or/not) vs. operating on each bit.
  3. 3Bitwise operators&, |, ^ and ~ — logic applied bit by bit.
  4. 4Working with single bitsMasks: check, set, clear and flip one bit at a time.
  5. 5Shifting bits left and right<< and >> slide the bits — and multiply or divide by powers of 2.
  6. 6QuizCheck your grip on logical and bitwise operations.