Python program to check whether the input character is an alphabet

Program to check whether the input character is an alphabet

In this session, we are going to discuss about a Python program to check whether the input character is an alphabet.  Here  user 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”. Before starting this session the beginners should know about the advantages of Python.

Advantages of Python: 

Python is Interpreted − Python is processed at runtime by the interpreter. You do not need to compile your program before executing it. This is similar to PERL and PHP.
Python is Interactive − You can actually sit at a Python prompt and interact with the interpreter directly to write your programs.
Python is Object-Oriented − Python supports Object-Oriented style or technique of programming that encapsulates code within objects.
Python is a Beginner's Language − Python is a great language for the beginner-level programmers and supports the development of a wide range of applications from simple text processing to WWW browsers to games.


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”.

Program Code

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 1

Enter a character: 22
22 is not an Alphabet

Output 2

Enter a character: B
B is an Alphabet







And also Check. 


Post a Comment

If you any doubts, Please let me know

Previous Post Next Post