Python : If Statement

It is a conditional statement used for decision making in python. In if statement, the test condition is evaluated and the statements inside the if block are executed only if the evaluated condition is true. In if statement, we have only one set of statements to select based on the test condition. So, it is also called as One-way selection statement.

Below is the syntax of simple if statement:

Python if Statement

Example:

a=10
if(a>0):
   print("Positive Integer")

Output

Positive Integer