Python Program to check character is Uppercase or not

Write a Python program to check character is Uppercase or not with a practical example.

Python Program to check character is Uppercase using isupper function

In this Python example, we use an isupper string function to check whether a given character is Uppercase or not.

# Python Program to check character is Uppercase or not
ch = input("Please Enter Your Own Character : ")

if(ch.isupper()):
    print("The Given Character ", ch, "is an Uppercase Alphabet")
else:
    print("The Given Character ", ch, "is Not an Uppercase Alphabet")

Python uppercase character or not output

Please Enter Your Own Character : I
The Given Character  I is an Uppercase Alphabet
>>> 
Please Enter Your Own Character : j
The Given Character  j is Not an Uppercase Alphabet

Python Program to find character is Uppercase or not

This python program allows a user to enter any character. Next, we are using If Else Statement to check whether the user given character is uppercase or not. Here, If statement (ch >= ‘A’ and ch <= ‘Z’) checks the character is greater than or equal to A, and less than or equal to Z if it is TRUE, it is an uppercase. Otherwise, it’s not an uppercase character.

# Python Program to check character is Uppercase or not
ch = input("Please Enter Your Own Character : ")

if(ch >= 'A' and ch <= 'Z'):
    print("The Given Character ", ch, "is an Uppercase Alphabet")
else:
    print("The Given Character ", ch, "is Not an Uppercase Alphabet")
Python Program to check character is Uppercase or not 2

Python Program to Verify character is Uppercase or not using ASCII Values

In this Python code, we are using ASCII Values to check the character is uppercase or not.

# Python Program to check character is Uppercase or not
ch = input("Please Enter Your Own Character : ")

if(ord(ch) >= 65 and ord(ch) <= 90):
    print("The Given Character ", ch, "is an Uppercase Alphabet")
else:
    print("The Given Character ", ch, "is Not an Uppercase Alphabet")
Please Enter Your Own Character : p
The Given Character  p is Not an Uppercase Alphabet
>>> 
Please Enter Your Own Character : T
The Given Character  T is an Uppercase Alphabet

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.