Python String islower() method
Last Updated :
18 Aug, 2022
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.
Python String islower() Method Syntax
Syntax: string.islower()
Returns:
- True: If all the letters in the string are in lower case and
- False: If even one of them is in upper case.
Python String islower() Method Example
Output:
True
Example 1: Demonstrating the working of islower()
Python3
islow_str = "geeksforgeeks"
not_islow = "Geeksforgeeks"
print ( "Is" , islow_str, "full lower ? : " + str (islow_str.islower()))
print ( "Is" , not_islow, "full lower ? : " + str (not_islow.islower()))
|
Output:
Is geeksforgeeks full lower ? : True
Is Geeksforgeeks 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
test_str = "Geeksforgeeks is most rated Computer \
Science portal and is highly recommended"
list_str = test_str.split()
count = 0
for i in list_str:
if (i.islower()):
count = count + 1
print ( "Number of proper nouns in this sentence is : "
+ str ( len (list_str) - count))
|
Output:
Number of proper nouns in this sentence is : 3
Share your thoughts in the comments
Please Login to comment...