isupper() String Method in Python with Examples
isupper()
method returns True
if the string is a uppercase string otherwise it returns False
.
A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.
Example 1: isupper() String Method
message = 'WELCOME TO PYTHON'
if message.isupper():
print('"%s" is uppercase string.' %(message))
else:
print('"%s" is not uppercase string.' %(message))
Output
"WELCOME TO PYTHON" is uppercase string.
Example 2: isupper() String Method
message = 'Welcome to Python'
if message.isupper():
print('"%s" is uppercase string.' %(message))
else:
print('"%s" is not uppercase string.' %(message))
Output
"Welcome to Python" is not uppercase string.
Related String Methods