Understand Python statements easily—the building blocks of every Python program. Learn their types, syntax, and usage with simple explanations and examples.
Statement in Python
At its core, every Python program you write is made up of individual statements. Think of a statement as a single, actionable instruction given to the computer to perform a specific task—whether it is storing a piece of data, making a calculation, or displaying a message on the screen.
A statement is an instruction written in a Python program that tells the computer to perform a specific task. Every Python program is made up of statements.
Examples of Statements
var1 = var2 # Assignment statement
x = input(“Enter a number”) # Input statement
print(“Total =”, R) # Output statement
Types of Statements in Python
Python statements are mainly of three types:
- Empty Statement
- Simple Statement
- Compound Statement
Empty Statement
An Empty Statement is a statement that does nothing. It is represented by the pass keyword.
Python executes the pass statement and immediately moves to the next line without performing any action.
Syntax:
pass
Example:
for i in range(5):
pass
print(“Loop completed”)
Output:
Loop completed
Note: The pass statement is used as a placeholder when a statement is required by Python’s syntax but no action needs to be performed at that moment.
Simple Statement
A Simple Statement is a statement that performs a single action. It is usually written on a single line.
Examples
age = 18 # Assignment statement
name = input(“Enter your name: “) # Input statement
print(name) # Output statement
Each of the above statements performs only one task.
Compound Statement
A Compound Statement consists of a header followed by a body (suite) containing one or more indented statements.
The header always ends with a colon (:), and the body must be written with proper indentation.
General Syntax:
statement_header:
statement1
statement2
Example:
marks = 75
if marks >= 40:
print(“Pass”)
print(“Congratulations!”)
Explanation:
- Header: if marks >= 40:
- Body: The two indented print() statements.
- If the condition is True, both statements inside the body are executed.
Quick Summary
| Statement Type | Description | Example |
| Empty Statement | Performs no action; used as a placeholder. | pass |
| Simple Statement | Performs a single action. | x = 10, print(x) |
| Compound Statement | Has a header and an indented body containing one or more statements. | if, for, while |


