The islower
method will return True
if all the alphabetical characters present in the string are in lowercase. If any character of the string is in uppercase or no alphabetical character is present in the string, then False
is returned.
string.islower()
True
:
False
in any one of the below cases:
If any character of the string is in uppercase.
If no alphabetical character is present in the string.
# True - because all characters are lowercasestring = 'all lowercase';print(string.islower())# False - because N is uppercasestring = 'Non lowercase';print(string.islower())# False - because no alphabetical character presentstring = '10';print(string.islower())# True - because one alphabetical character present and that character is in lower casestring = '12b';print(string.islower())# False - because one alphabetical character present and that character is not lower casestring = '12B';print(string.islower())
In the code above, we call the islower
method:
For the all lowercase
string, the islower
method will return True
because all the characters of the string are lowercase letters.
For the Non lowercase
string, the islower
method will return False
because the string contains one uppercase letter (N
).
For the 10
string, the islower
method will return False
because the string contains no alphabetical letter.
For the 12b
string, the islower
method will return True
because the string has one alphabetical character, and that character is in lowercase.
For the 12B
string, the islower
method will return False
because the string has one uppercase character (B
).