All lessons

Functions

9 min · Python

Package code under a name so you can reuse it.

Python · Functions0/5 cleared

Enemy 1 of 5

A function is a named block of code you can run whenever you want. You define it with def, give it a name, and indent the body. Nothing runs until you call it by name with ().

Run this — defining greet prints nothing; calling greet() is what runs it.

You
Syntax Skeleton

Loading editor...

Ln 1, Col 1Spaces: 4
Sign up to fightTarget output: Hello!