Python String | islower() method

Python has many utility functions in its libraries that always help us to achieve some common day-day task. Let’s see the working of string islower() method which actually checks if all characters in the string are lowercase.

Syntax : string.islower()

Parameters : None



Returns : True if all the letters in the string are in lower case and False if even one of them is in upper case.

Code #1 : Demonstrating the working of islower()

filter_none

edit
close

play_arrow

link
brightness_4
code

# Python3 code to demontrate
# working of islower()
  
# initializing string 
islow_str = "geeksforgeeks"
not_islow = "Geeksforgeeks"
  
# checking which string is 
# completely lower 
print ("Is geeksforgeeks full lower ? : " + str(islow_str.islower()))
print ("Is Geeksforgeeks full lower ? : " + str(not_islow.islower()))

chevron_right


Output:

Is geeksforgeeks full lower ? : True
Is Geeksforgeeks full lower ? : False

 

Practical Application: This function can be used in many ways and has many practical applications. One such application being checking for lower cases, checking proper nouns, checking for correctness of sentence which requires all lower cases. Demonstrated below is small example showing the application of islower() method.

Code #2 : Demonstrating the practical application of islower() method

filter_none

edit
close

play_arrow

link
brightness_4
code

# Python3 code to demontrate
# application of islower() method
  
# checking for proper nouns.
# nouns which start with capital letter
  
test_str = "Geeksforgeeks is most rated Computer \
            Science portal and is highly recommended"
  
# spliting string 
list_str = test_str.split()
  
count = 0
  
# counting lower cases
for i in list_str:
    if (i.islower()):
        count = count + 1
  
# printing proper nouns count 
print ("Number of proper nouns in this sentence is : "
                            + str(len(list_str)-count))

chevron_right


Output :

Number of proper nouns in this sentence is : 3


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.