Build a Function: Coding lesson for kids
In this lesson, children learn to define a function with def and call it to avoid repeating code.
def add(a, b):: Defines a function named add that takes two inputs, called parameters: a and b.
total = a + b: Inside the function (indented), this computes total by adding the two parameters together.
return total: Sends the value of total back out to wherever the function was called.
This lesson is part of Python in Coding at Pearls Valley Academy — Real code, beginner-friendly syntax.
Each lesson starts with a short narrated, animated explanation, then hands-on practice. A wrong answer gets a gentle hint, never a penalty, and children earn stars and pearls as they go.