Concepts

Week 1

  • installing our development environment

Week 2

  • editing a .py Python program and executing it in the shell
  • the iPython REPL
  • uv add ipython to install; and then uv run ipython to launch
  • expressions, operators, values, & variables
  • operator precedence
  • using brackets ( and ) to override operator precedence
  • numeric vs character string data types
  • variables: str, int, float, bool, inspect using type()
  • conversion: str(), int(), float()
  • operators: + - * /, **, modulus %
  • logical operators < > == >= <= != and or not True False
  • import statements—for example, from math import cos
  • print() and formatted output using f-strings
  • getting input from the user using input()
  • commenting code using #
  • reserved keywords in Python (e.g. for, return, etc)
  • getting help using help()
  • Visual Studio Code

Week 3

  • conditionals if elif else
  • loops using while and for
  • range() versus list types
    • “range objects are a specific type of sequence in Python, they behave similarly to lists or tuples but are immutable and lazy”
  • the FizzBuzz coding exercise
  • zero-based indexing in Python
  • putting it all together: testing primeness of integers

Week 4

  • lists in Python
  • list comprehensions e.g. five_odd_numbers = [i for i in range(1,11,2)]
  • in Python list variables are pointers
  • b = a vs b = a.copy()
  • b == a vs b is a
  • other complex data types in Python: tuples, ranges, dictionaries, and sets
  • writing your own functions in Python
    • defining a function
    • function header
    • input arguments
    • the work
    • returning output(s)
    • variable scope
    • named inputs
    • default values
  • the idea of modularity of code

Week 5

  • NumPy arrays
  • creating arrays
  • np.zeros() and np.ones()
  • shape of arrays using np.shape()
  • multidimensional arrays
  • vectorized operations on arrays
  • slicing & indexing into arrays
  • file input & output: low-level
    • all files are binary, a series of 8-bit bytes
    • ASCII encoding (and utf-8 more modern version)
    • using hex editor to view a file as hexadecimal bytes
    • Python defaults: 32-bit int, 64-bit float, 8-bit char
    • little-endian vs big-endian byte ordering (sys.byteorder to check)
    • using numpy to read and write binary bytes by specifying dtype
  • file input & output: high-level using NumPy & pandas