Unit 1

Section 1

  • Decimal numbers are natural for humans, but binary are better for computers.
  • Binary numbers consist of zeros and ones.
  • How to count in the binary system.
  • How to generate random binary numbers.
  • How to convert decimal numbers to binary.
  • How to convert binary numbers to decimal.
  • Each digit in a binary number represents one bit (1 b).
  • Basic data types including integer (int), real number (float), text string (str), tuple (tuple), list (list), dictionary (dict) etc.
  • How to check types of variables.
  • How to generate random integers.

Section 2

  • How to add (positive decimal) integers using the pencil-and-paper method.
  • How binary numbers are added.
  • Adding any base-n numbers including base-8 (octal) numbers.
  • How computers process decimal numbers.
  • How the binary shift works.

Section 3

  • How to use the bitwise shift operators << and >>.
  • How to use the bitwise shift update operators <<= and >>=.
  • How to use the bitwise AND operator &.
  • How to use the bitwise OR operator |.
  • How to use the bitwise XOR operator ^.
  • The above operators also work with Booleans True and False.
  • How to use the bitwise complement operator ~.

Section 4

  • Big advantage of hex numbers over decimal ones.
  • Three main applications of hex numbers .
  • How to count in the hex system.
  • How to generate random hex numbers.
  • How to convert decimal numbers to hex.
  • How to convert hex numbers to decimal.
  • Hex numbers can be defined using the prefix ‘0x’.

Section 5

  • Special relationship between hex and binary numbers.
  • Hex numbers can be converted to binary one digit at a time.
  • Binary numbers can be converted to hexadecimal in four-digit chunks.
  • How to count in the octal number system.
  • How to convert decimal numbers to octal and vice versa.
  • Binary, hexadecimal and octal numbers can be defined using the prefixes ‘0b’, ‘0x’ and ‘0o’, respectively.
  • How to protect your functions against flawed input, especially against flawed user data.
  • Sanity checks can take more lines than the actual function body.

Unit 2

Section 6

  • Transistor count, Moore’s Law, and CPU clock speed.
  • Exploring transistors and logic gates.
  • Using Python to simulate the seven basic types of logic gates: AND, OR, NOT, NAND, NOR, XOR, and XNOR.
  • Practicing safe programming with assertions and exceptions.

Section 7

  • Combining logic gates and simulating simple logic circuits in Python.
  • Simulating the XOR gate using the AND, OR and NAND gates, as well as using the AND, OR and NOT gates.
  • Simulating the Half Adder using the XOR and AND gates.
  • Simulating the Full Adder by adjusting the Half-Adder to be stackable.
  • Simulating the Two-Bit, Four-Bit and Eight-Bit Adders as arrays of Full Adders.
  • Simulating the Full-Adder using the XOR, AND and OR gates.

Section 8

  • Various uses of the underscore character _ in Python.
  • Role of the so-called “shift” in multiplication.
  • Performing multiplication with just addition and shift.
  • Simulating the Four-Bit Multiplier using the Eight-Bit Adder.
  • Simulating the Eight-Bit Multiplier using the Sixteen-Bit Adder.