Python Practice
Hands-on Python lessons - write real code, run it instantly, and get checked by real tests.
Python Practice
Twenty-two short, hands-on Python lessons: start with your first print statement, build up through error handling, generators, classes, and recursion, debug a real traceback, then climb into the code that runs clean and is still wrong. Each lesson gives you a task and a Run button - your code is checked against real tests the moment you run it. Everything runs in your browser.
The last six are the ones that bite at work. A traceback tells you where to
look; these do not get you that. A default argument that was built once and
remembers the last shopper, a loop that skips items because the list shrank
under it, a copy that was never really a copy, a total that is off by a cent
because money went through a float, and a capstone where or 0 quietly turns
"nobody recorded this" into "this was zero" and drags an average down with it.
Start with lesson 1. You can leave and come back any time - your code is saved locally.
Lessons
22 total- 01 Print and variables
- 02 Conditionals
- 03 Loops
- 04 Lists
- 05 Dictionaries
- 06 Error handling
- 07 Generators
- 08 Fix the bug: read the traceback
- 09 Classes and inheritance
- 10 List comprehension rewrite
- 11 Recursion kata: factorial and Fibonacci
- 12 Stats calculator: mean and variance
- 13 String-alignment formatter
- 14 Time calculator
- 15 Probability calculator
- 16 Capstone: word counter
- 17 Fix the bug: the second cart is not empty
- 18 Fix the bug: the list shrinks while you walk it
- 19 Fix the bug: the copy that everyone shares
- 20 Fix the bug: every handler reports the last channel
- 21 Fix the bug: the till is a penny short
- 22 Capstone: the average that reads too low