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:
Related Posts:
- C Program to check whether a character is an Alphabet or not
- Python program to check if a number is prime or not
- Python program to check even or odd
- Python program to add two numbers
- Python program to print Hello World
Leave a Reply