Header Ads

Responsive Ads Here

Nested if-else Statement

 Nested if-else Statement



# Condition1  - if
    # Condition1  - if
        # Condition1  - if
        # Condition2  - else
    # Condition2  - else
   
# Condition2  - else
    # Condition5  - if
    # Condition6  - else



num = 12

if num <= 50:
    if num <= 25:
        print("Number is less than 26.")
        if num < 15:
            print("Number is less than 15.")
    else:
        print("Number is greater than 25, But less than 51.")
       
else:
    if num <= 75:
        print("Number is less than 76.")
    else:
        print("Number is greater than 75, But less than 101.")
     
Powered by Blogger.