Python Program to Check Alphabet

Python Program to Check Alphabet

In this post, we will write a Python program to check whether the entered character is an Alphabet or not.

Python Code

In this program, user is asked to enter a character and the input character is stored in a variable. The program checks whether the entered character lies in the range of lowercase or uppercase alphabets, if it does then the program displays the message that the “character is an Alphabet” else it displays that the “character is not an Alphabet”.
# taking user input
ch = input("Enter a character: ")
if((ch>='a' and ch<= 'z') or (ch>='A' and ch<='Z')):
    print(ch, "is an Alphabet")
else:
    print(ch, "is not an Alphabet")
 
 
Output:
Python Program to check Alphabet


No comments:

Post a Comment

Your feedback is highly appreciated and will help us to improve our content.