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.

Sign Up for Our Newsletters

Get notified of the best deals on our WordPress themes.

You May Also Like
Remove Character From String Python

Remove Character From String Python

Table of Contents Hide Python Remove a Character from a StringPython Remove Character from String using replace()Remove a single character from a stringRemove all occurrences of a character from a…
View Post
Python String Startswith()

Python String startswith()

Table of Contents Hide startswith() Syntaxstartswith() Parameterstartswith() Return ValueExample 1: startswith() Without start and end ParametersExample 2: startswith() With start and end ParametersPassing Tuple to startswith() Python String startswith() method…
View Post