In this python program, we will learn how to check if a given character is lowercase or not. In this program, we will use two ways to check if the character is lowercase or not. First by checking if the given character is in between a-z and the other way to check is by using built-in python function: islower()
.
Here is the source code of the program to check if a given character is lowercase or not.
Python Program to check if a Character is Lowercase or Not
# Python Program to check if a Character is Lowercase or Not
# Take the Input from the User
ch = input("Enter any Character: ")
if(ch >= 'a' and ch <= 'z'):
print("The Given Character", ch, "is a Lowercase Alphabet")
else:
print("The Given Character", ch, "is Not a Lowercase Alphabet")
Enter any Character: A
The Given Character A is Not a Lowercase Alphabet
Enter any Character: c
The Given Character c is a Lowercase Alphabet
# Python Program to Check if a Character is Lowercase or Not - using islower() function
# Take the Input from the User
ch = input("Enter any Character: ")
if(ch.islower()):
print("The Given Character", ch, "is a Lowercase Alphabet")
else:
print("The Given Character", ch, "is Not a Lowercase Alphabet")
Enter any Character: Z
The Given Character Z is Not a Lowercase Alphabet
Enter any Character: h
The Given Character h is a Lowercase Alphabet
Comments