Python program to check Alphabet or Digit

ch = input("Please Enter Your Own Character : ")
if((ch >= 'a' and ch <= 'z') or (ch >= 'A' and ch <= 'Z')):
    print("The Given Character ", ch, "is an Alphabet")
elif(ch >= '0' and ch <= '9'):
    print("The Given Character ", ch, "is a Digit")
else:
    print("The Given Character ", ch, "is Not an Alphabet or a Digit")

OUTPUT:

Please Enter Your Own Character : j
The Given Character  j is an Alphabet
>>>
Please Enter Your Own Character : 6
The Given Character  6 is a Digit
>>>
Please Enter Your Own Character : .
The Given Character  . is Not an Alphabet or a Digit

Leave a Comment