Demonstration Of nested...if Statements In Python Programs

Demonstration Of nested...if Statements In Python Programs

Code
# Demostration Of nested if-else statement...

num=int(input("Enter a number.\n"))
if(num<0):
    print("Number is negative.")
elif(num>0):
    if(num<10):
        print("Number is between 1-10.")
    elif(num>10 and num<=20):
        print("Number is between 11-20.")
    else:
        print("Number is greater than 20.")
else:
    print("Number is ZERO.")
    
Output
Enter a number.
8
Number is between 1-10.

Post a Comment