Python – If-elif-else

if-elif-else: if-elif-else is a control flow structure in programming that allows a program to execute different blocks of code based on one or more conditions.

Check the Given number is Single Digit or Two Digit or Three Digit or Other

n = int(input(“Enter number :”))
if(n>=0 and n<=9):
    print(“Single digit”)
elif(n>=10 and n<=99):
    print(“Two digit”)
elif(n>=100 and n<=999):
    print(“Three digit”)
else:
    print(“Other digits number”)

Check the given character is Upper case or Lower case or Digit or Symbol:

ch = input(“Enter character :”)
if(ch>=’A’ and ch<=’Z’):
    print(“Upper case alphabet”)
elif(ch>=’a’ and ch<=’z’):
    print(“Lower case alphabet”)
elif(ch>=’0′ and ch<=’9′):
    print(“Digit”)
else:
    print(“Symbol”)
Scroll to Top