Skip to content
Home » isalpha() Method in Python

isalpha() Method in Python

Learn about isalpha() Method in Python in the below code example. Also, refer to the comments in the code snippet to get a detailed view about what’s actually happening.

isalpha() Method in Python

If all of the characters in the string are alphabets, the isalpha() method returns “True,” else it returns “False.” This function determines whether the given contains solely alphabet characters (mentioned below). True if all of the characters in the string are alphabetic.

Program:

# Python program to check whether a character is alphabet or not

# character input
ch = input("Enter any character: ")

# check charater is alphabet or not
if(ch.isalpha()):
    print(ch, "is an Alphabet.")
else:
    print(ch, "is not an Alphabet.")

Output:

Enter any character: c
c is an Alphabet.

You can also check for a sequence of characters like:

Enter any character: SimilarGeeks
SimilarGeeks is an Alphabet.

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

Similar Code : Python Program to Check Whether Character is Alphabet