Ten hands-on exercises to practise what you've learned from the script library.
Each exercise has a starter file (exercise.py) with TODO markers guiding you step by step,
and a solution file (solution.py) to check your work afterwards.
How to use these:
- Read the
exercise.pyfile top to bottom — the comments explain everything.- Fill in the
TODOsections yourself, one at a time.- Run your script frequently to test as you go:
python exercise.py- Only peek at
solution.pywhen you're truly stuck or want to compare approaches.
| # | Title | Key Concepts | Difficulty |
|---|---|---|---|
| 01 | File Extension Report | pathlib, Counter, sorting |
⭐ Beginner |
| 02 | Find Files by Pattern | glob, fnmatch, generators |
⭐ Beginner |
| 03 | Disk Space Alert | psutil, thresholds, exit codes |
⭐ Beginner |
| 04 | Process Watchdog | psutil, loops, conditionals |
⭐⭐ Intermediate |
| 05 | HTTP Health Checker | urllib, status codes, timeouts |
⭐⭐ Intermediate |
| 06 | Log Grepper | re, os.walk, generators |
⭐⭐ Intermediate |
| 07 | Uptime Logger | csv, time.sleep, append mode |
⭐⭐ Intermediate |
| 08 | Environment Inspector | os.environ, filtering, sorting |
⭐ Beginner |
| 09 | Directory Size Report | os.walk, recursion, formatting |
⭐⭐ Intermediate |
| 10 | System Health Snapshot | json, combining modules, datetime |
⭐⭐⭐ Advanced |
- Don't panic at errors — read the last line of the traceback first. That's the actual problem.
- Use
print()everywhere while debugging. Remove them when it works. - Python docs: https://docs.python.org/3/library/
- Look up any function:
help(sorted)in the Python REPL gives you instant docs. - Google is allowed — real developers search constantly. The skill is knowing what to search for.