LambdaLabTM
Computer Science · Class 11 · Types of Statements
Types of StatementsOverview⏱️ 8 min read

Introduction to Statements

Every program you have written so far has run top to bottom, once each. That is one way for a program to behave, and it is the only one you have needed. This chapter is about the others — the statements that let a program choose, repeat, and leave early.

1First, what a statement is

A statement is one instruction that Python carries out. That is the whole definition. You have been writing them since the first lesson without needing the word:

three_statements.py
marks = 40
marks = marks + 10
print(marks)
Output
50

Three lines, three statements: store 40, work out 50 and store that, show it. Python did them in the order they were written, each exactly once, and then the program ended.

Note
Statement or expression? An expression is something that has a value2 + 3 is 5, marks > 40 is True. A statement is something Python does. Expressions usually live inside statements: marks = 2 + 3 is one statement containing one expression.

2The five kinds of statement

Python organises that order with five kinds of statement. You have been using one of them all along without knowing its name; the other four are the lessons that follow this one.

🗺️ The five kinds

Tap any one to see the shape it makes. Only the first is due today — the rest are the lessons after this.

Sequential

you know this one

Do this, then this, then this.

the shape it makes
statement 1
statement 2
statement 3

One statement after another, top to bottom, each one exactly once. This is what Python does unless you tell it otherwise — which is why every program you have written so far is made only of these.

written with
no keyword — it is the default
KindIt answersWritten with
SequentialDo this, then this, then this.nothing — it is the default
Selection (conditional)Should I run this at all?if · elif · else
Iterative (looping)Should I do that again?for · while
EmptyWhat if I want to do nothing?pass
JumpCan I leave early?break · continue
Watch Out
Two names for the same thing. Books and question papers use selection and conditional for the same kind of statement, and iterative and looping for the same one. Learn both words for each — you will meet whichever one the paper happens to use.
Key Takeaway
A statement is one instruction Python carries out, and the order they run in is what makes a program a program. Python has five kinds: sequential, selection (conditional), iterative (looping), empty and jump. Each one gets a lesson of its own, starting with sequential in the next one.

3If that felt like a lot, read this

Tip
Do not feel alarmed if the last section confused you. It was meant to go slightly over your head — it is a map of a place you have not visited yet, and a map only makes proper sense once you have walked some of it.

Nobody expects you to be able to write an if or a while after reading this page. You have not been taught them, and you are not meant to know them yet.

For now, one thing is enough: Python has five kinds of statement sequential, selection, iterative, empty and jump. That is the whole take-away. Each of them gets a lesson to itself in the sections that follow, with examples you can run, and every one of them will be explained from the beginning when you get there. Come back to this page after those lessons and you will find it reads as a summary rather than as a preview.

Quick Check

Which kind of statement have you been writing since your very first program?

Quick Check

Another name for a selection statement is: