if statement
if statement:
An "if statement" is the most simple decision making statement written by using the if keyword. The if statement contains a logical expression using which data is compared and a decision is made based on the result of the comparison.
Syntax
if condition:
statement1
statement2
If the boolean expression evaluates to TRUE, then the block of statement(s) inside the if statement will execute. If boolean expression evaluates to FALSE, then the first set of code after the end of the if statement(s) will execute.
Example
a = 33
b = 200
if b > a:
print("b is greater than a")
When the above code is executed, it output the following result −
C:\Users\My Name>python demo_if2.py
b is greater than a