Tutorials
Practical tutorials for the work we actually do. Pick one, read it in order, and apply it.
A traceback is not the problem. It's the first clue. Four questions you ask every time, tried on real tracebacks that try to mislead you: errors in one file caused by another, errors deep inside Python's own code, two tracebacks in one message, and syntax errors that point to the wrong line.
If a person reads your output, format it. f-strings let you mix text and values, round numbers, add thousands separators and line up a table, with very little code. Formatting is for people, not for data files.
The four list moves you need on day one: make a list, add to it, remove from it, and loop over it. Plus the one mistake that gives wrong results without any error. Nothing more. The rest can wait until you need it.
A bare except hides typos and real bugs behind wrong results. Catch the specific error you expect, keep the try block small, and let everything else crash where you can see it.
Defaults make functions easier to call and keywords make calls easier to read. A list as a default value is created once and shared by every call. Here's why, and the one-line fix.
An if/elif chain stops at the first true condition. Put the widest one first and the others never run, with no error. Order your conditions, test the edges, and make else mean what you think.
Python is probably installed. Your terminal just can't find it. Check the three possible causes in order, fix the right one on Windows, Mac or Linux, and confirm which Python you're really running.
/, //, % and round() each do exactly what they say, and that's not always what school math taught you. Negative numbers, halves and money are where the surprises are, and where Decimal comes in.
Python refuses to guess whether "5" + 5 means 55 or 10. Convert with int(), float() and str() where values come in, handle text that won't convert, and avoid the bool("False") trap.
People type the wrong thing, sometimes more than once. A while True loop with try/except, a range check and a way out keeps asking until the answer is usable, so the rest of your code never has to check again.
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.