Python if Statement

This statement is used to execute one or more statement depending on whether a condition is True or not.

The syntax or correct format of if statement is given below:

CopiedCopy Code

if condition: 
	statements 
							
							

First, the condition is tested. If the condition is True, then the statements given after colon (:) are executed. We can write one or more statements after colon (:).

If the condition is False, then the statements mentioned after colon are not executed.

CopiedCopy Code

num=1 
if num==1: 
   print("One")
 							

If statment flow chart

Python if Statement