Coding for Kids · Lesson

What Is a Function?

A function is a reusable set of steps.

Lesson 1 of 413 steps

What Is a Function? is a free Coding for Kids lesson on CoddyKit. This is lesson 1 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.

A Magic Recipe

Hi explorer! 🧑‍🍳 Today we learn about functions.

A function is like a recipe. It is a group of steps you save so you can use them again and again!

Why Recipes Help

Imagine making a sandwich. 🥪

  • Get the bread
  • Add cheese
  • Close it up

If you write these steps once, you can make a sandwich any time without thinking hard!

Doing It Over and Over

Without a recipe, you would explain every step every single time. So tiring! 😴

A function lets you say one short word and all the steps happen. Like magic! ✨

A Function in Python

In Python a recipe looks like this. The word def means "I am making a recipe".

Run it and see the friendly hello! 👋

def say_hello():
    print("Hello, friend!")

say_hello()

The Name of the Recipe

See the part say_hello? That is the name of our recipe.

You pick the name yourself, just like naming a pet! 🐶

Calling the Recipe

Writing say_hello() is called calling the function.

It means: "Hey recipe, do your steps now!" 🎬

def say_hello():
    print("Hello, friend!")

say_hello()
say_hello()

Use It Again and Again

Look! We called say_hello() twice, so it said hello two times! 🎉

That is the superpower of functions: write once, use many times.

Many Steps Inside

A recipe can have many steps inside. Watch this birthday recipe! 🎂

def birthday():
    print("Happy Birthday!")
    print("Make a wish!")
    print("Blow the candles!")

birthday()

Steps Stay Together

All the lines under def birthday(): are indented (pushed right with spaces).

That spacing tells Python "these steps belong to the recipe". 🧩

Functions Save Time

Good helpers do not repeat themselves. Functions help us be tidy coders! 🧹

Less typing, fewer mistakes, more fun. 😄

You Are a Chef Now

You learned what a function is: a saved recipe of steps with a name. 🍳

Next we will write our very own! Get ready! 🚀

Quick Check

Let us test your chef brain! 🧠

Great Job!

Woohoo! You now know what functions are. 🎉

Remember: a function = a reusable recipe. See you in the next lesson, chef! 👨‍🍳

Free to start

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 “What Is a Function?” lesson free?

Yes — the full text of “What Is a Function?” 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 “What Is a Function?”?

A function is a reusable set of steps. 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 1 of 4.

How long does the “What Is a Function?” 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

  1. What Is a Function?
  2. Writing Your First Function
  3. Giving Functions Inputs
  4. Returning a Result
← Back to Coding for Kids