Check uppercase or lowercase in python by R4R Team

example-

a,b,c,d,........x,y,z they are the lowercase alphabet
and
A,B,C,D,...........X,Y,Z they are the uppercase alphabet


Program -

a=input("Enter charactern")
if a.isalpha():
if 65<=ord(a)<=90:
print("It is a Uppercase")
else:
print("It is a lowercase")
else:
print("It is not alphabet")

#second way
if a.isalpha():
if a.isupper():
print("It is a Uppercase")
else:
print("It is a lowercase")
else:
print("It is not alphabet")


output -

Enter character
h
It is a lowercase
It is a lowercase

Enter character
K
It is a Uppercase
It is a Uppercase

Enter character
1
It is not alphabet
It is not alphabet

Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!