Decision making with Python if

Control flow statments like Python if-elif-else can be used to make decision in Python on the basis of a Boolean Condition.

Decision Statement: When the Boolean Condition following if keyword is True, the program control will flow to the enclosed block of code, else skip over it.

Python if-elif-else syntax

    if condition:
        statements
    elif condition:
        statements:
    ...
    else:
        statements
                                

Note: else is not mandatory with if or after elif.

paragraph 3

    sub-code
                                

Joining Python if conditions

and, or can be used to join condition whereas not can be used to negate the condition.
Emample:

    if condition1 and condition2:
        ...
        
    if condition1 or condition2: 
        ...
        
    if not i%2==0:
        ...
        
    if var: # !=None
        ...
        
    if "hello".isupper():
        ...