Work with real shapes of data / CORE PATH
Comparisons & branching
Branch on explicit conditions and keep unknown values distinct.
Translate a Power Query conditional column or SQL CASE into readable Python.
Understand the idea
Branch on explicit conditions and keep unknown values distinct. Translate a Power Query conditional column or SQL CASE into readable Python.
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
- Combine conditions with and, or and not.
- Use is None for an absent value.
- Write complete boundary rules before coding.
A small original example
def amount_status(value):
if value is None:
return "missing"
if value < 0:
return "invalid"
return "zero" if value == 0 else "valid"Practice on your own data
Task 07: label missing, negative, zero and positive amounts.
Practice this lesson in the Python lab →
None → missing; -1 → invalid; 0 → zero; 1 → valid.
Common pitfalls
- = assigns; == compares.
- if not value merges zero with missingness.
Prerequisites
Boot.dev chapter 7 · 02:27:43 ↗
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 ↗