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("Lowercase")
else:
print("Not Lowercase")Output:
str = codeallow
str type = <class 'str'>
Lowercase
Free resources to learn advanced skills: AiHints and CodeAllow
