Python String islower()

Python String islower() method is a built-in function that returns True if all the characters in the string are lowercase. If the string contains at least one uppercase character, the method returns False.

islower() Syntax

The syntax of islower() method is:

string.islower()

islower() Parameter

The islower() method doesn’t take any parameters.

islower() Return Value

The islower() method returns:

  • True if all alphabets in a string are lowercase alphabets.
  • False if the string contains one or more uppercase alphabets.

Example 1: Demonstrating the working of islower() method

text1="Itsmycode"
text2="itsmycode"

print("Is Itsmycode all lowercase:",text1.islower())
print("Is itsmycode all lowercase:",text2.islower())

Output

Is Itsmycode all lowercase: False
Is itsmycode all lowercase: True

Example 2: Practical use case of islower() in a program

The following program will determine if the given sentence consists of all lowercase characters.

text1 = "Python is fun"
text2 = "python tutorials"

if(text1.islower()==True):
    print("The text contains all lowercase characters")
else:
    print("The text contains at least one uppercase characters")

if(text2.islower()==True):
    print("The text contains all lowercase characters")
else:
    print("The text contains at least one uppercase characters")

Output

The text contains at least one uppercase characters
The text contains all lowercase characters
Leave a Reply

Your email address will not be published. Required fields are marked *

Sign Up for Our Newsletters

Get notified of the best deals on our WordPress themes.

You May Also Like
List of Python free ebooks

List of Free Python Books

Table of Contents Hide Python SuccinctlyPython Data Science HandbookThink Python 2nd EditionAutomate the Boring Stuff with PythonMaking Games with Python & PygameData Structures and Algorithms in Python Google Python Style GuideA…
View Post