Returning a Result
Send an answer back from a function.
Returning a Result is a free Coding for Kids lesson on CoddyKit. This is lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Coding for Kids learning path, and your progress syncs across the web and the CoddyKit app. The Coding for Kids course includes 4 lessons in total.
Functions That Give Back
Hi superstar! ⭐ So far our recipes printed things.
Today they will return something, like handing you a gift back!
What Is Return?
The word return means "give this answer back to whoever called me". 🎁
It is different from print. Return hands you a value to use!
Returning a Number
This recipe adds two numbers and returns the answer. Run it! 👇
def add(a, b):
return a + b
answer = add(2, 3)
print(answer)We Saved the Answer
See answer = add(2, 3)? 🎉
The function returned 5, and we stored it in a box called answer. Then we printed it!
Print vs Return
print shows something on the screen. 👀
return hands a value back so you can use it later. 🤝
Use the Result
Because the function returns a value, we can do more math with it! 🔢
def double(n):
return n * 2
result = double(5)
print(result + 1)Doubled and More
Cool! double(5) gave back 10, then we added 1 to get 11! 🎈
Returned values are super useful.
Return a Word Too
You can return words, not just numbers. 📝
def make_greeting(name):
return "Hi, " + name + "!"
message = make_greeting("Zoe")
print(message)A Friendly Message
The recipe built a greeting and returned it. We saved it in message and printed it. 💌
Return Ends the Recipe
Once a recipe says return, it stops right there. 🛑
It hands back the answer and is done!
You Are Brilliant
You learned return: how functions give answers back. 🏆
Now your recipes can cook AND deliver! 🍕
Quick Check
Final challenge! 💪
Recipe Champion!
Amazing! 🎉 You finished the Recipe Functions course!
You can write functions, give them inputs, and return results. You are a real coder now! 🥳
Learn Python with an AI tutor — free
Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.
- Courses
- 35
- Lessons
- 140
Frequently Asked Questions
Is the “Returning a Result” lesson free?
Yes — the full text of “Returning a Result” is free to read here on the web. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Coding for Kids course, upgrade to CoddyKit PRO. The Coding for Kids course includes 4 lessons in total.
What will I learn in “Returning a Result”?
Send an answer back from a function. You practise Coding for Kids with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Coding for Kids?
No prior experience is required. Coding for Kids on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 4 of 4.
How long does the “Returning a Result” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Coding for Kids lesson?
Yes. Every Coding for Kids lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- What Is a Function?
- Writing Your First Function
- Giving Functions Inputs
- Returning a Result