Write a program to check whether a given character is Alphabet or not using if else statement Note: Check for both upper and lower case characters
Question
Write a program to check whether a given character is Alphabet or not using if else statement
Note: Check for both upper and lower case characters.
Solution
Sure, here is a simple Python program that checks if a given character is an alphabet or not:
# Input character
char = input("Enter a character: ")
# Check if the character is an alphabet
if ((char >= 'a' and char <= 'z') or (char >= 'A' and char <= 'Z')):
print(char, "is an Alphabet")
else:
print(char, "is not an Alphabet")
This program works by checking if the input character falls within the ASCII value range of lowercase and uppercase alphabets. If it does, it prints that the character is an alphabet. If it doesn't, it prints that the character is not an alphabet.
Similar Questions
Write a C program to read an English Alphabet through keyboard and display whetherthe given alphabet is in upper case or lower case.
Write a C program to check whether an alphabet is vowel or consonant using switch case
Write a program that takes a string of lowercase characters as input and prints it in uppercase, reversed.
Write a C program to read a sentence and replace lowercase characters with uppercase and vice versa.
Find the ASCII codes of letters in lower and upper cases, numbers, and special characters
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.