Python String isalpha()

The syntax of isalpha() is:

string.isalpha()

isalpha() Parameters

isalpha() doesn't take any parameters.


Return Value from isalpha()

The isalpha() returns:

  • True if all characters in the string are alphabets (can be both lowercase and uppercase).
  • False if at least one character is not alphabet.

Example 1: Working of isalpha()

name = "Monica"
print(name.isalpha())

# contains whitespace
name = "Monica Geller"
print(name.isalpha())

# contains number
name = "Mo3nicaGell22er"
print(name.isalpha())

Output

True
False
False

Example 1: Working of isalpha()

name = "MonicaGeller"

if name.isalpha() == True:
   print("All characters are alphabets")
else:
    print("All characters are not alphabets.")

Output

All characters are alphabets

Also Read:

Did you find this article helpful?

Your builder path starts here. Builders don't just know how to code, they create solutions that matter.

Escape tutorial hell and ship real projects.

Try Programiz PRO
  • Real-World Projects
  • On-Demand Learning
  • AI Mentor
  • Builder Community