Example
Input
Enter the character A
Output
Uppercase alphabet
Required to Know
Use of Variables, Use of different operators like assignment or arithmetic operators, Use of functions like print(), and input(), Use of If-else, and Use of Data types.
Steps
Take the character as input from the user.
Check if the character that has been entered falls under this range: -
- a-z
If the character falls under this range print it as a lowercase alphabet. Otherwise, print it as an uppercase alphabet.
Program
# This program takes a character as input and prints whether it is lowercase or uppercase.
# Get the character from the user.
char = input("Enter the character: ")
# Check if the character is lowercase.
if char >= 'a' and char <= 'z':
# Print "Lowercase alphabet".
print("Lowercase alphabet")
# Otherwise, check if the character is uppercase.
else:
# Print "Uppercase alphabet".
print("Uppercase alphabet")