Skip to content
Related Articles
Open in App
Not now

Related Articles

Python String isupper() method

Improve Article
Save Article
  • Last Updated : 18 Aug, 2022
Improve Article
Save Article

Python String isupper() method returns whether all characters in a string are uppercase or not.

Python String isupper() method Syntax

Syntax: string.isupper()

Returns: True if all the letters in the string are in the upper case and False if even one of them is in the lower case. 

Python String isupper() method Examples





Example 1: Demonstrating the working of isupper()


# Python3 code to demonstrate
# working of isupper()
# initializing string
isupp_str = "GEEKSFORGEEKS"
not_isupp = "Geeksforgeeks"
# Checking which string is
# completely uppercase
print ("Is GEEKSFORGEEKS full uppercase ? : " + str(isupp_str.isupper()))
print ("Is Geeksforgeeks full uppercase ? : " + str(not_isupp.isupper()))


Is GEEKSFORGEEKS full uppercase ? : True
Is Geeksforgeeks full uppercase ? : False

Example 2: Practical Application

Python String isupper() function can be used in many ways and has many practical applications. One such application for checking the upper cases, checking Abbreviations (usually upper case), checking for correctness of sentence which requires all upper cases. Demonstrated below is a small example showing the application of isupper() method.


# Python3 code to demonstrate
# application of isupper()
# checking for abbreviations.
# short form of work/phrase
test_str = "Cyware is US based MNC and works in IOT technology"
# splitting string
list_str = test_str.split()
count = 0
# counting upper cases
for i in list_str:
    if (i.isupper()):
        count = count + 1
# printing abbreviations count
print ("Number of abbreviations in this sentence is : " + str(count))


Number of abbreviations in this sentence is : 3

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!