CurriculumPython Functions, Parameters and return for KidsThe Dragon's Two Abilities

Practice Challenge: Choosing print() or return in Python

print() shows it, deliver() sends it — choosing the right channel for each function.

Lesson 4 of 5PROAges 10+
See what PRO unlocks →

The Dragon's Two Abilities

You've learned three things about functions. Let's put them together for the final challenge.

One: def names a group of code, and calling it runs that code again from the top.

Two: parameters let one function produce different results for different calls.

Three: a function that returns hands a value BACK — deliver() is how you actually send that value on.

The challenge ahead has two functions with two different jobs. Picking the right channel for each is the whole point.

Check your understanding

One function's whole job is to SHOW a message. Another's job is to CALCULATE a number for later use. Which one should use return?

  • The one calculating a number — its result needs to be handed back and used
  • Both should return, since return is always the more powerful choice

Why: The calculating one. If a value needs to be USED afterward (added, compared, delivered), it should return. If a function's whole job is just showing something, print() inside it is enough.

What you'll practice

def compute_total(gold, gems): return gold + gems * 10. Print a label ("TOTAL VALUE:"), then deliver the result of compute_total(20, 3).

Unlock this lesson with PRO →

More from this topic

The Dragon's Two Abilities 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 →