Skip to main content

Python String issuper() Function

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() function does not take any parameters.

issuper() Return Value​

Python String issuper() function returns:

  • True if all characters in the string are uppercase.
  • False if 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: True

output

True

The 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: True

output

False
True

The method also returns False, if the string contains at least one lowercase alphabet.

my_str = '123a$@%'

print(my_str.isupper()) # Output: False

output

False

Example 2: Check if an Empty String is uppercase​

An empty string is not lowercase.

my_str = ''

print(my_str.isupper()) # Output: False

output

False