Bench Python WeekendPython from zero, taught with the PA Test Bench code All courses
0 of 31 exercises
Python loading…

A two-day course built from the PA Test Bench code

Bench Python Weekend

You start knowing no Python. By Sunday evening you can read drivers.py, test_engine.py and main_gui.py, explain what a function does, and write a driver class, a limit check and a small sequence runner of your own.

Every example here is a real line from the app, cited by file and line number, or a small piece of code shaped like one. The code boxes run real Python in this page, so you can change anything and press Run. Nothing here can reach the bench.

There are 12 lessons and 31 exercises. Each exercise has a Check button that tests your code against several cases, a Hint, and the Solution. Your progress and your code are kept in this browser.

Saturday: the language

09:00Python runs top to bottom
print, comments, variables, numbers and math, using dBm and watts.
45 min
09:55Text and f-strings
Strings, string methods, converting text to numbers, and the f-strings every log line uses.
50 min
10:55Making decisions
if / elif / else, comparisons, and/or/not, None and truthiness.
45 min
11:40Lunch, away from the screen60 min
12:40Lists and loops
Lists, for loops, range, enumerate, while, break, and nested loops like a Vd × Vg sweep.
60 min
13:50Functions
def, parameters, return, default and keyword arguments, returning two values.
60 min
15:00Dictionaries: the step format
Dicts, [] versus .get(), looping over items, and a sequence as a list of dicts. Ends with the Day 1 capstone.
70 min

Sunday: building like the app

09:00When things go wrong
Reading errors, try / except / finally, raise, and the bench's rules for missing data.
55 min
10:05Classes: modelling an instrument
class, __init__, self, attributes and methods, built around a fake instrument.
60 min
11:15Inheritance and duck typing
Subclasses, super(), class attributes, isinstance, mixins, getattr and hasattr.
60 min
12:15Lunch, away from the screen60 min
13:15Pythonic power tools
Comprehensions, zip, sorted and max with key=, lambda, ** dict merging, and the copy trap.
60 min
14:25Modules, files and data
import, the __main__ guard, with open(...), JSON for sequences, CSV for results.
50 min
15:25Callbacks, threads and the queue
Functions as values, why the engine runs on its own thread, the GUI's mailbox, and the Day 2 capstone.
75 min

How to get the most out of two days

  • Type, don't paste. Retyping an example is slower and it is the point: your fingers learn the colons and the indentation.
  • Break things on purpose. Delete a colon, misspell a name, run it, and read the error. Lesson 7 is easier when you have already met them.
  • Try before you peek. Give an exercise ten honest minutes, then the hint, then the solution. Then close the solution and write it again.
  • Keep the walkthroughs open. The PDFs on your machine explain the same code in depth. Each "From the bench" box tells you where to look.

Two days gets you to reading and changing this codebase with confidence. Fluency comes from using it the week after, so the Monday page lists real tasks to do in the repository.

Start lesson 1