CurriculumPython Functions, Parameters and return for Kidsreturn hands a value back
return vs print() in Python: What's the Difference?
return doesn't print anything — deliver() is where a returned value actually goes.
return hands a value back
Every function you've written so far printed its own output. return is different — it hands a value BACK, silently.
def compute_damage(): return 10 — calling compute_damage() does NOT print 10. It gives you 10 back, to use however you want.
def compute_damage():
return 10That's why print() and return can look confusingly similar, but aren't. print() shows something. return HANDS SOMETHING BACK for your code to use next.
deliver(value) is a new ability — it actually SENDS a value somewhere, using whatever a function returned.
deliver(compute_damage())And calling a function is never a one-way trip — once it returns, your code keeps going with the very next line, same as always.
Check your understanding
def compute_damage(): return 10 — with NO print() anywhere inside it. Does calling compute_damage() show anything on its own?
def compute_damage():
return 10
compute_damage()Why: No — nothing shows. return only hands the value back; something else (print() or deliver()) has to actually show or use it.
deliver(compute_damage()), then print("DONE") on the next line. Does "DONE" still print?
deliver(compute_damage())
print("DONE")Why: Yes, DONE still prints. A function call finishes and returns, then your code carries on with the next line — exactly like any other instruction.
What you'll practice
def compute_damage(): return 10 — this ability hands back a number instead of printing anything itself. Deliver that returned value to the battle log with deliver(compute_damage()).
More from this topic
return hands a value back is one lesson inside Python Functions, Parameters and return for Kids — see the full lesson order and what the whole topic covers.
View the full topic →