Python Coding Tutorial

Learn the basics of Python. Just enough to be dangerous with numbers and for loops. Nothing fancy. We’ll be mostly using Python as a basic calculator for math expressions, and “boring” calculations that require repeating the same action many times (for loops).

So if you know how to use a calculator, then you know how to use Python too.

If you remember some basic math concepts like variables, expressions, and functions, then you already know most of all there is to know!

TOC:

Upcoming:

  • Objects and Classes: classes, example: custom interval class

  • Command line interface: similar to how in computing user interfaces click (or double click) means “run ”, a command line interface allows us to run programs by simply typing out their name, as in program and pressing Enter. This is where the notion of “calling a program/function” comes from, you just write it’s name in a command line prompt and this is equivalent to “calling it” (making it run, just click clicking on it)

  • Command line scripts: run any python code on command line using python myscript.py (or if configured as an executable script, simply ./myscript.py)

  • Numerical computing: numpy

  • Scientific computing: scipy

  • Documentation: READMEs, doc strings, and other technical altruism basics

  • Debugging (intro to JupyterLab debugger)

  • Code Testing (e.g. test_fun: a function that checks that fun returns the expected outputs on some set of inputs)

  • Algorithms: different approaches for solving computational problem