Tutorials
Practical tutorials for the work we actually do. Pick one, read it in order, and apply it.
glob() searches one folder, rglob() searches every folder below it. Neither sorts the results, skips folders like .venv, or matches .CSV on Linux.
pip freeze gives exact versions but hides what you chose. A hand-written file shows what you chose but isn't exact.
Separate zero collected tests from an import failure, install into the correct environment, and prove the selected test catches a broken assertion.
for line in file reads one line at a time, so a 10 GB file uses almost no memory. read() and readlines() load everything.
Downloads spend most of their time waiting. ThreadPoolExecutor lets many waits overlap: 20 half-second downloads in 2 seconds instead of 10.
Python refuses to guess whether "5" + 5 means 55 or 10.
People type the wrong thing, sometimes more than once.
Write a context manager when something must be undone no matter how the block ends.
Find the button, attach a listener, change something on the page when it's clicked. Three steps, and two mistakes that make it silently do nothing.
Arrays hold lists: cart items, names, scores. Create them, read them, add and remove items, find things, and copy them without changing the original by accident.
Arrow functions are a shorter way to write a function, and they are everywhere in modern JavaScript.
console.log is the fastest way to see what your code is doing, until it prints 300 lines and you can't find the one that matters.