This program is much similar to the previous one but here we are checking whether the given character is an alphabet, digit or a special character.

Function isalpha()

The function isalpha() is used to check whether the character is an alphabet or not.

Function isdigit()

The function isdigit() is used to check whether the character is a digit or not.

Program

# Take character input from user
ch = 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.