Think in Python / CORE PATH
Functions & explicit contracts
A function turns named inputs into a useful result with a clear contract.
Think of a reusable Power Query function, but make data dependencies explicit.
Understand the idea
A function turns named inputs into a useful result with a clear contract. Think of a reusable Power Query function, but make data dependencies explicit.
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
- Separate input/output from transformation logic.
- Use return values, parameters and small docstrings.
- Specify valid inputs and the result unit.
A small original example
def net_revenue(gross, discount):
if not 0 <= discount <= gross:
raise ValueError("discount outside gross amount")
return gross - discountPractice on your own data
Task 03: calculate net revenue from gross and discount piastres.
Practice this lesson in the Python lab →
net_revenue(10000, 1500) is 8500; a discount larger than gross is rejected.
Common pitfalls
- A missing return produces None.
- A function that mutates input may surprise its callers.
Prerequisites
Variables, types & missing values
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.
Python - The Basics - Part 1 | جحر السوعبان
Loads YouTube on request. Open on YouTube ↗ if the owner restricts embedding.
Python Full Course for Beginners (13 Hours) – From Zero to Hero
Loads YouTube on request. Open on YouTube ↗ if the owner restricts embedding.
03 تعليم الآلة , القسم الثالث : بايثون Machine learning , Python
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
- Python - The Basics - Part 1 | جحر السوعبان ↗User-selected YouTube resource
- Python Full Course for Beginners (13 Hours) – From Zero to Hero ↗User-selected YouTube resource
- 03 تعليم الآلة , القسم الثالث : بايثون Machine learning , Python ↗User-selected YouTube playlist · also in the inherited DE catalog · Inherited from data-engineering-learning-roadmap: Ahmed Shaaban mentorship
Track progress on this topic → · Markdown source ↗