← Go Back
If the string has no letters, both methods return false:
How to Check if a String Is All Uppercase or Lowercase
Theisupper()
string method returns true only if all letters in the string are uppercase, and islower()
only if all letters are lowercase.>>> a = "UPPERCASE"
>>> b = "lowercase"
>>> c = "MiXeD"
>>> a.isupper()
True
>>> a.islower()
False
>>> b.isupper()
False
>>> b.islower()
True
>>> c.isupper()
False
>>> c.islower()
False
>>>
If the string has no letters, both methods return false:
>>> "!ยท$%&/)-123".isupper()
False
๐ You might also find interesting: