Last Updated : 11 Jul, 2025
isupper() method in Python checks if all the alphabetic characters in a string are uppercase. If the string contains at least one alphabetic character and all of them are uppercase, the method returns True
. Otherwise, it returns False
.
Let's understand this with the help of an example:
Python
s = "GEEKSFORGEEKS"
print(s.isupper())
Explanation:
s'
contains only uppercase alphabetic characters.isupper()
method returns True
.Parameters
string.isupper()
isupper()
method does not take any parameters.True
if all alphabetic characters in the string are uppercase.False
if the string contains lowercase letters or non-alphabetic characters.Let’s examine a case where the string is entirely uppercase, we can use this to validate input when uppercase formatting is required, such as for acronyms or constants.
Python
s1 = "PYTHON"
print(s1.isupper())
Explanation:
s1
is made up entirely of uppercase alphabetic characters.True
, confirming that all alphabetic characters in s1
are uppercase.This method is helpful when we want to ensure that no lowercase letters are present in a string.
Python
s2 = "PyThOn"
print(s2.isupper())
Explanation:
s2
contains both uppercase (P
, T
, O
) and lowercase (y
, h
, n
) characters.isupper()
returns False
.Let’s check how isupper()
behaves when the string contains numbers or special characters.
s3 = "123#@!"
print(s3.isupper())
Explanation:
s3
contains only non-alphabetic characters (numbers and special symbols).isupper()
returns False
.This method is useful when validating input strings with uppercase letters and spaces, such as titles or banners.
Python
s4 = "PYTHON IS FUN"
print(s4.isupper())
Explanation:
s4
contains uppercase alphabetic characters and spaces.True
, confirming that all alphabetic characters in s4
are uppercase.This is useful when we want to ensure that we’re working with meaningful input before applying further processing.
Python
s5 = ""
print(s5.isupper())
Explanation:
s5
is empty and does not contain any characters.isupper()
method returns False
since there are no uppercase alphabetic characters to validate.RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4