The islower() function in python helps to check whether all the alphabets in the string are lowercase. The function returns True if all the alphabets are lowercase. If it contains at least one uppercase letter then it will return False.
string.islower()
The islower() method doesn't take any parameters. The function will check only alphabet characters no numbers, symbols, and spaces are checked.
The return value is always a boolean value. If a given string contains only symbols or numbers this method will return false. The string that needs to be checked must contain at least one alphabet char.
Input | Return Value |
---|---|
all lowercase alphabets | True |
at least one uppercase | False |
string = 'python programming'
print(string.islower())
string = 'python123 programming345'
print(string.islower())
string = 'Python programming'
print(string.islower())
Output:
True True False
string = 'hi how are you?'
if string.islower() == True:
print('All are lowercase letters.')
else:
print('Contains uppercase letter.')
string = 'Hi how are you?'
if string.islower() == True:
print('String does not contain uppercase letter.')
else:
print('String Contains uppercase letter.')
Output:
All are lowercase letters. String Contains uppercase letter.