Home »
Python
Python String isupper() and islower() Methods
By IncludeHelp Last updated : December 15, 2024
The isupper() and islower() both are the in- built methods in Python which works with the strings.
String isupper() Method
isupper() returns "true" if all characters of the string are uppercase character.
Syntax
String.isupper()
Parameters
None
Return Value
- true - if all characters of the string are uppercase characters.
- false - if any of the characters is not in uppercase character.
Example
# str1 with all uppercase characters
str1 = "GOOGLE"
print(str1.isupper())
# str2 with uppercase character, DOT, SPACE
str2 = "GOOGLE.COM"
print(str2.isupper())
# str3 with uppercase and lowercase characters
str3 = "GOOGLE.com"
print(str3.isupper())
# str4 with all lowercase characters
str4 = "google.com"
print(str4.isupper())
Output
True
True
False
False
String islower() Method
islower() returns "true" if all characters of the string are lowercase character.
Syntax
String.islower()
Parameters
None
Return Value
- true - if all characters of the string are lowercase characters.
- false - if any of the characters is not in lowercase character.
Example
# str1 with all lowercase characters
str1 = "google"
print(str1.islower())
# str2 with lowercase character, DOT, SPACE
str2 = "google.com"
print(str2.islower())
# str3 with lowercase and uppercase characters
str3 = "google.COM"
print(str3.islower())
# str4 with all uppercase characters
str4 = "GOOGLE.COM"
print(str4.islower())
Output
True
True
False
False