Open In App

Python String islower() Method

Last Updated : 11 Nov, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

The islower() method in Python checks if all characters in a string are lowercase. It returns True if all alphabetic characters are lowercase, otherwise, it returns False, if there is at least one uppercase letter.

Let's look at a quick example of using the islower() method.

Python
s = "hello"
res = s.islower()
print(res)

Output
True

Explanation: The string s contains only lowercase alphabetic characters, so islower() returns True.

Syntax of islower()

s.islower()

Parameter:

  • This method doesn't take any parameter.

Return Value:

  • The method return True if all alphabetic characters in the string are lowercase, otherwise False.

Example of islower()

Let’s look at a few examples of islower() method.

Python
s1 = "hello"
res1 = s1.islower()
print(res1)

s2 = "Hello"
res2 = s2.islower()
print(res2)

s3 = "hello123"
res3 = s3.islower()
print(res3)

s4 = ""
res4 = s4.islower()
print(res4)

s5 = "123@"
res5 = s5.islower()
print(res5)

Output
True
False
True
False
False

Explanation:

  • s1 is "hello": contains only lowercase letters, so islower() returns True.
  • s2 is "Hello": has an uppercase 'H', so islower() returns False.
  • s3 is "hello123": all alphabetic characters are lowercase, so islower() returns True.
  • s4 is "": an empty string returns False by default.
  • s5 is "123@": contains no alphabetic characters, so islower() returns False. At least one lowercase letter is needed for True.

Related Articles:


Next Article
Practice Tags :

Similar Reads