Python program to check Character is an Alphabet, Digit or Special Character

h = input("Enter any character : ")
# Check for alphabet and digit.
if ch[0].isalpha() :
    print("\n" + ch[0], "is A ALPHABET.")
elif ch[0].isdigit() :
    print("\n" + ch[0], "is A DIGIT.")
else :
    print("\n" + ch[0], "is A SPECIAL CHARACTER.")

OUTPUT:

Enter any character : @
@ is A SPECIAL CHARACTER.

Sharing Is Caring

Leave a Comment