🧩Return Value
Also known as return, Return Statement
The result a function hands back when done. The return line sends it out.
Think of it like
Think of it like a vending machine dropping your snack. You put coins in, and one thing comes back out.
Example
add_tax(10) returns 12.0. The checkout page stores that in total and shows it to the buyer.
Why it matters
Definition
Example code
python
def add_tax(price):
return price * 1.2
total = add_tax(10)
print(total) # 12.0Common mistake
Key takeaways
- 1Hands back a result. The caller can store or use it.
- 2Ends the function. Nothing after return runs.
- 3Not the same as print. Print shows it; return gives it.