Updated: Feb 16, 2022
if statements is execute a certain block of Python code when a particular condition is true. Whenever If..else statements are execute true and false condition both. if condition is true and a different set of statements if condition is false. For example we want to print ‘even number’ if the number is even and ‘odd number’ if the number is not even,
We can understand if else statement by following example.
statement 1: This would execute if the given condition is true
statement 2: This would execute if the given condition is false
num = 22
if num % 2 == 0:
If else Statement Program Video in Python: