Python if Statement

If statements are control flow statements which helps us to run a particular code only when a certain condition is satisfied. if statement is the most simple decision making statement. It is used to decide whether a certain statement or block of statements will be executed or not.

An if statement allows you to write a block of code that gets executed only if the expression after if is true.

Syntax:

if (condition):
    (statement)

Example:

if (2<3):
    print("Hello")

Output:

Hello

Tags