Think in Python / CORE PATH
Testing & debugging
A failing example is evidence you can narrow to a specific cause.
Apply your troubleshooting habit: reproduce, inspect, change one thing, verify.
Understand the idea
A failing example is evidence you can narrow to a specific cause. Apply your troubleshooting habit: reproduce, inspect, change one thing, verify.
Work through the practice with a tiny fixture, predict the result before running it, and record one boundary case. Use the exit check as evidence before moving on.
What to learn
- Read a traceback from the final exception back to your call.
- Write a normal, empty and boundary example.
- Keep assertions in tests; use explicit validation in application code.
A small original example
def mean_or_none(values):
return sum(values) / len(values) if values else None
assert mean_or_none([0, 10]) == 5Practice on your own data
Task 05: fix mean_or_none so empty data is meaningful and zero is retained.
Practice this lesson in the Python lab →
mean_or_none([]) is None; mean_or_none([0, 10]) is 5.
Common pitfalls
- Do not use bare except to hide a failure.
- assert can be disabled; it is not a production input-validation boundary.
Prerequisites
Boot.dev chapter 5 · 01:28:55 ↗
Video and playlist companions
Choose one explanation for the concept, then attempt the practice. These are topic mappings, not a claim that every linked lesson covers every outcome.
Boot.dev · Python for Beginners
Loads YouTube on request. Open on YouTube ↗ if the owner restricts embedding.
كورس Python منحة ITI
Loads YouTube on request. Open on YouTube ↗ if the owner restricts embedding.
Sources and further reading
- Boot.dev · Python for Beginners ↗User-selected YouTube course
- كورس Python منحة ITI ↗User-selected ITI playlist
- Harvard CS50P · lectures & problem sets ↗User-selected HarvardX CS50P course
- Python language tutorial ↗Official documentation
Track progress on this topic → · Markdown source ↗