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.
In the first line, print True if has any alphanumeric characters. Otherwise, print False.In the second line, print True if has any alphabetical characters. Otherwise, print False.In the third line, print True if has any digits. Otherwise, print False.In the fourth line, print True if has any lowercase characters. Otherwise, print False.In the fifth line, print True if has any uppercase characters. Otherwise, print False.
Write a C program to check whether an alphabet is vowel or consonant using switch case
Problem StatementSuresh is working on a program that checks the case of an input character. He needs a simple solution that uses a function called check() to determine whether the given character is in uppercase, lowercase, or invalid. Can you assist Suresh in creating this program?Note: This question helps in clearing technical coding tests for companies like Wipro.Input format :The input consists of a single character.Output format :The output is a single line indicating the case of the input character. It can be one of the following:"Upper Case" if the input character is an uppercase letter."Lower Case" if the input character is a lowercase letter."Invalid" if the input character is neither an uppercase nor a lowercase letter.Refer to the sample outputs for formatting specifications.Sample test cases :Input 1 :aOutput 1 :Lower CaseInput 2 :VOutput 2 :Upper CaseInput 3 :$Output 3 :InvalidInput 4 :5Output 4 :InvalidNote :The program will be evaluated only after the “Submit Code” is clicked.Extra spaces and new line characters in the program output will result in the failure of the test case.Marks : 10Negati
Write a program that prints the alphabet in lowercase, followed by a new line.Print all the letters except q and eYou can only use the putchar function (every other function (printf, puts, etc…) is forbidden)All your code should be in the main functionYou can only use putchar twice in your code
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.