Here is the Course Outline from Fall 2025.

COMP 202, 204, and 208 are all equivalent as prerequisites for COMP 250 and COMP 206. The difference between COMP 202 and COMP 208 is that the latter assumes students have a background in basic Calculus and Linear Algebra which appear in some of the examples and in the assignments. (COMP 204 assumes some background in Life Sciences.)

Lecture Topics

  • Introduction. course outline, binary numbers, converting from binary to decimal. Binary in computers: int, float, text, images & audio. Programming languages: high and low level, compilers vs interpreters.
  • Python basics, IDE's (Thonny). Hello World. Comments, strings, statements, errors. Print function. String concatenation. Escape sequences. Values and types. Type casting. Shell vs editor. Operators (+, *). Syntax coloring (green functions and pink strings).
  • Variables and assignment statements. Variable naming rules and conventions, objects, aliasing, swapping, garbage collection. Input prompt. Operations on numbers. implicit casting. order of operations. expressions.
  • Operators. Comparison operators, boolean values. equality and float. logical operators (not, and, or), boolean expressions and short circuit evaluation. shorthand assignments (e.g. x += 3).
  • Control flow. if, if-else if-elif,nesting & indentation. Style.
  • Functions. built in math functions, void versus non-void, creating own function: header, parameters, body. Nested functions. Flow of execution. void functions that take input, arguments, scope (local vs global variables), function parameters. None type. Non-void functions: return statements, examples of non-void functions. Docstrings.
  • Loops. : while loops, iteration. if versus while. infinite loop. for loops : break, continue, and while vs. for.
  • Numerical methods (examples of loops). Newton's method for sqrt, numerical integration using midpoint method, root finding using bisection.
  • Debugging. syntax errors, runtime errors & code execution, logic errors, infinite loops, Using print statements vs. debugger. Raising exceptions, doctest.
  • Strings. : indexing, slicing, immutability. string methods, in, loop by value/index, off-by-one errors
  • Lists: indexing, slicing, concatenating, replicating, in, not in. list functions and methods, list comprehension. String methods using lists: split, join.
  • List algorithms. Linear search. Binary search. Bubble sort.
  • Mutability. id(), "is" versus ==, lists vs strings. Optimization issues (caching, garbage collection).
  • Nesting. nested loops, nested lists, shallow and deep copy of a list.
  • File IO. open, methods: read, write, CSV format, pickle
  • Matplotlib.
  • Tuples. unpacking and multiple assignments. for loops and lists of tuples. enumerate
  • Sets and Dictionaries . set methods, dicts: keys and values, dict methods: get, pop, keys, values, len, in, iterating through dict, set/dict comprehensions
  • Modules and import. __name__ and "__main__", math, turtle, random
  • OOP: classes, instantiating objects, attributes, constructors, default arguments, instance methods, __str__, __eq__
  • NumPy: arrays, indexing and slicing, shape, vectorization, boolean indexing, images, random walks, Monte Carlo