1. If Statement

The Python if executes a block of statements conditionally, based on a Boolean expression.

Syntax:

if expression :
    statement_1 
    statement_2
    ....

In this case, expression specifies the conditions which are based on Boolean expression. When a Boolean expression is evaluated it produces either a value of true or false. If it evaluates to True, the indented block of statements is executed. This block of code is called an "if block."

Example:

x = 5
if x > 3:
    print("x is greater than 3")

"Python if elif else" by w3resource is licensed under CC BY-SA 4.0