Python String islower() Method Example
Python3
print ( "geeks" .islower()) |
Output:
True
Example 1: Demonstrating the working of islower()
Python3
# initializing string islow_str = "w3wiki" not_islow = "w3wiki" # checking which string is # completely lower print ( "Is" , islow_str, "full lower ? : " + str (islow_str.islower())) print ( "Is" , not_islow, "full lower ? : " + str (not_islow.islower())) |
Output:
Is w3wiki full lower ? : True Is w3wiki full lower ? : False
Example 2: Practical Application
This function can be used in many ways and has many practical applications. One such application is checking for lower cases, checking proper nouns, checking for correctness of sentences that requires all lower cases. Demonstrated below is a small example showing the application of Python islower() method.
Python3
# checking for proper nouns. # nouns which start with capital letter test_str = "w3wiki is most rated Computer \ Science portal and is highly recommended" # splitting 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)) |
Output:
Number of proper nouns in this sentence is : 3
Python String islower() method
Python String islower() method checks if all characters in the string are lowercase.
This method returns True if all alphabets in a string are lowercase alphabets. If the string contains at least one uppercase alphabet, it returns False.