Dremendo Tag Line

Check character is uppercase, lowercase, digit or symbol in Python

if elif - Question 4

In this question, we will see how input a character and check if it is an uppercase alphabet or lowercase alphabet or digit or a special symbol in Python programming using the if elif statement. To know more about if elif statement click on the if elif statement lesson.

Q4) Write a program in Python to input a character and check if it is an uppercase alphabet or lowercase alphabet or digit or a special symbol.

Program

c=input('Enter a character ')

if c>='A' and c<='Z':
    print('Uppercase alphabet')
elif c>='a' and c<='z':
    print('Lowercase alphabet')
elif c>='0' and c<='9':
    print('Digit')
else:
    print('Special symbol')

Output

Enter a character 8
Digit
video-poster