Check a String is Lowercase in Python

  • Post category:String

In this article, you will see how to check a string is lowercase in Python. A lowercase string is a string that contains only lowercase letters. The string islower() method returns True if all characters in the string are lowercase, otherwise False.

Step 1: Create a string

str = "codeallow"
print("str = ", str)
print("str type = ", type(str))

Step 2: Check if a string is lowercase

if all(c.islower() for c in str):
    print("Not Lowercase")


str =  codeallow
str type =  <class 'str'>

Free resources to learn advanced skills: AiHints and CodeAllow