All lessons

Making Decisions

8 min · Python

Run different code depending on whether something is true.

Python · Making Decisions0/5 cleared

Enemy 1 of 5

Programs make choices by checking whether something is true. You compare values with operators like > (greater than), < (less than), and == (equal to — that's two equals signs for a comparison).

An if statement runs the indented code beneath it only when the condition is true. Run this:

You
Syntax Skeleton

Loading editor...

Ln 1, Col 1Spaces: 4
Sign up to fightTarget output: You are an adult