warming up your workspace

Python Foundations through Computational Physics

Never written code before? Start here. You will learn the basics of Python, output, variables, types, decisions, loops, and functions, through motion, speed, force, and energy. By the end you are ready for Project 1.

First words

  1. Make the computer speak
  2. Printing numbers
  3. Notes the computer ignores
  4. Words and labels
  5. Average speed

Remembering things

  1. Store a value in a name
  2. Change what a variable holds
  3. Numbers, decimals, and text
  4. Turn text into a number
  5. Names that explain themselves

Making choices

  1. Yes or no: is it fast?
  2. if: act only when true
  3. if / else: two paths
  4. elif: more than two cases
  5. and / or: combine conditions

Doing it again

  1. while: a drop countdown
  2. for and range: count steps
  3. Build a running total
  4. break: stop when it stops
  5. Loops inside loops

Many values and reuse

  1. A list of readings
  2. Loop a list to find the max
  3. Your first function
  4. Inputs and outputs
  5. Capstone: a speed classifier

Explore the full field