Python string islower() Method

In this tutorial, We will see the python string islower() method with examples.

islower() Method

The islower() method is one of the methods in a python string. Python string islower() method checks all the characters in the string are lowercase alphabets(a-z).

  • Return True, If all the characters in the string are lowercase alphabets.
  • Return False, If all the characters in the string are not lowercase alphabets.
Syntax of Python string islower() method

This is the syntax of the python string islower() method.

string.islower()
Example of the Python string islower() method
#Example 1 

text = "python is a programming language"
#check the text characters are in lowercase. 
print(text.islower())
#output : True
#Example 2

text = "PYTHON PROGRAMMING"
print(text.islower())

#output: False

#Exmaple 3

message = "hello WORLD"
msg = message.islower()
print(msg)


#output: False
# Example 4

message = "hello 123 @"
#contain number and special characters with lowercase alphabets.
msg = message.islower()
print(msg)

#output: True

text = "123 @"
#contain only number and special characters.
msg = message.islower()
print(msg)

#output: False


Related Programs
  • Take a string from the user and check characters in lowercase or not.
message = input("Enter the message")
msg = message.islower()
print(msg)
  • Take a string from the user and check the particular string in uppercase or in lowercase. if string characters are in uppercase, then convert them into lowercase, and if string characters are in lowercase, then convert them into uppercase.
message = input("Enter the message ")
if(message.isupper()):
      print(message.lower())
else:
      print(message.upper())

Related Posts