In this program, we are going to determine if the given character is Uppercase or Lowercase alphabet using python built-in function isupper() and islower().
Function isupper()
The isupper() function can be used to check if the character is Uppercase or not. It will return true if the character is Uppercase character.
Function islower()
The islower() function is opposite to isupper(), it checks if the character is Lowercase character or not.
Program
# Take input from user ch = input("Enter any character : ")[0] # Check for uppercase, lowercase if ch.isupper() : print("\n" + ch, "is UPPERCASE alphabet.") elif ch.islower() : print("\n" + ch, "is LOWERCASE alphabet.") else : print("\n" + ch, "is not an alphabet.")
Output
Enter any caracter : k
k is LOWERCASE alphabet.