The isupper()
method in Python is a part of String Methods. It is used to check if all the alphabetic characters in a string are uppercase. It will return True if all characters are uppercase, otherwise it will return False.
Parameter Values
This function does not accept any parameters.Return Values
The isupper()
method returns a bool
: True
or False
.
How to Use isupper()
in Python
Example 1:
The isupper()
method returns True if all the alphabetic characters in a string are uppercase, otherwise it returns False.
text = 'HELLO'
print(text.isupper()) # Output: True
Example 2:
In the case of a string containing both uppercase and lowercase alphabetic characters, isupper()
will return False.
text = 'Hello'
print(text.isupper()) # Output: False
Example 3:
When the string is empty, isupper()
will return False.
text = ''
print(text.isupper()) # Output: False