← Back to All Lessons

Functions - Reusable Code

ProgressStep 1 of 5

Step 1: What is a Function?

A function is a reusable block of code that performs a specific task. Instead of writing the same code over and over, write it once in a function, then call it whenever you need it! Basic syntax: def function_name(): code to run def means "define" - you're defining a new function.
Code Editor
Initializing editor...
💻 Output:
Click 'Run Code' to see output here...