The TaskFlow API turns a Python function into a task with @task. Calling the decorated function inside a Dag does not run it: it adds a task to the Dag and returns a reference to the task's future result. Pass that reference to another task, total_revenue(extract_sales()), and Airflow does two things: it sets the dependency, and at run time it hands the first task's return value to the second.
Return values travel through XCom, Airflow's store for small results, so return data that is small and JSON-friendly (lists, dicts, numbers, strings). print() only writes to the log; the next task cannot read it.
A task can also ask Airflow for facts about the run by naming them as parameters with a default of None: ds is the run's date as YYYY-MM-DD, logical_date the full timestamp. Use them instead of typing dates, so the same code loads the right day in every run and in backfills.
Returning a dict and passing @task(multiple_outputs=True) stores each key as its own XCom.