The if statements are the conditional statements in python.
An if statement tests a particular condition; if the condition is true, a statement or set of statement is executed. Otherwise, the statement is ignored.
syntax:-
if conditional statement: statements
In if statement indentation plays a major role. If indentation is wrong, indentation error is shown when execute the code.
Make sure to indent all statements in one block at the same level.
e.g.,
a = 5 b = 2 if b < a: print("b is less than a")
Output- b is less than a
This is all about if statement in python.