The String issuper() method returns True if the string is not empty and all the alphabet characters are lowercase. Otherwise, it returns False.
Syntax
my_string.isupper()issuper() Parameters
Python String issuper() method does not take any parameters.
issuper() Return Value
Python String issuper() method returns:
Trueif all characters in the string are uppercase.Falseif the string does not contain at least one cased character or if the string contains at least one lowercase alphabetic character.
Examples
Example 1: Check if all characters in the string are uppercase
The isupper() method returns True if all characters in the string are uppercase.
my_str = 'abcd'
result = my_str.isupper()
print(result) # Output: Trueoutput
TrueThe method returns False, if the string does not contain at least one cased character.
my_str1 = '123$@%'
my_str2 = 'A123$@%'
print(my_str1.isupper()) # Output: False
print(my_str2.isupper()) # Output: Trueoutput
False
TrueThe method also returns False, if the string contains at least one lowercase alphabet.
my_str = '123a$@%'
print(my_str.isupper()) # Output: Falseoutput
FalseExample 2: Check if an Empty String is uppercase
An empty string is not lowercase.
my_str = ''
print(my_str.isupper()) # Output: Falseoutput
False