The isupper function in Python evaluates a string and returns True if every character within that string is in uppercase. Conversely, it will return False if any character fails to meet the uppercase condition.
Syntax of Python String isupper Method
It has the following syntax:
isupper()
Parameters
No parameter is required.
Return
It returns either True or False.
Different Examples of Python String isupper Method
Let's explore a few examples of the isupper method to grasp its functionalities.
Example 1
Let’s consider an example to illustrate the functionality of the Python String isupper method.
# Python isupper() method example
# Variable declaration
str = "WELCOME TO LOGICPRACTICE"
# Calling function
str2 = str.isupper()
# Displaying result
print(str2)
Output:
Example 2
Let’s consider an additional example to illustrate the functionality of the Python String isupper method.
# Python isupper() method example
str = "WELCOME TO LOGICPRACTICE"
str2 = str.isupper()
print(str2)
str3 = "Learn Python Here."
str4 = str3.isupper()
print(str4)
Output:
True
False
Example 3
Let us examine another illustration to showcase the functionality of the Python String isupper Method.
# Python isupper() method example
str = "WELCOME TO LOGICPRACTICE"
str2 = str.isupper()
print(str2)
str3 = "WELCOME To LOGICPRACTICE."
str4 = str3.isupper()
print(str4)
str5 = "123 @#$ -JAVA."
str6 = str5.isupper()
print(str6)
Output:
True
False
True