Python islower() is one of the Python String Method returns True if all string characters are in lowercase. It returns False if not in lowercase.
The syntax of the method is: str.islower()
Key Points :
• There are no parameters for the islower() method.
• If a string is all letters in the lowercase, this method returns true and false otherwise.
• If all other characters in the specified string are alphabet and lowercase, this returns true for whitespace. This method returns false for a string of only whitespaces.
• This approach returns false for digits and symbols.
We’ll be covering the following topics in this tutorial:
Return Value from islower()
The islower() method returns:
• True if all characters in the string are alphabets in a lower case.
• False if at least one uppercase alphabet is included in the string.
Below is the python program to demonstrate the islower() function:
str = "The Best Learning Resource for Online Education"; print (str.islower()) str = "the best learning resource for online education"; print (str.islower())
When we run above the program, the outcome is as follows:
False
True
How to use islower() in a program?
str = 'the best learning resource for online education' if str.islower() == True: print('Does not contain uppercase letter.') else: print('Contains uppercase letter.') str = 'The Best Learning Resource For Online Education' if str.islower() == True: print('Does not contain uppercase letter.') else: print('Contains uppercase letter.')
When we run above the program, the outcome is as follows:
Does not contain uppercase letter.
Contains uppercase letter.
Below are several other functions that we can use to work with string in Python 3