Python String isupper() method
Python String isupper() method returns whether or not all characters in a string are uppercased or not.
Syntax:
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
string.isupper()
Parameters:
The isupper() method doesn’t take any parameters.
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.
Example 1: Demonstrating the working of isupper()
Python3
# Python3 code to demonstrate# working of isupper()# initializing stringisupp_str = "GEEKSFORGEEKS"not_isupp = "Geeksforgeeks"# Checking which string is# completely uppercaseprint ("Is GEEKSFORGEEKS full uppercase ? : " + str(isupp_str.isupper()))print ("Is Geeksforgeeks full uppercase ? : " + str(not_isupp.isupper())) |
Output:
Is GEEKSFORGEEKS full uppercase ? : True Is Geeksforgeeks full uppercase ? : False
Example 2: Practical Application
This 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 small example showing the application of isupper() method.
Python3
# Python3 code to demonstrate# application of isupper()# checking for abbreviations.# short form of work/phrasetest_str = "Cyware is US based MNC and works in IOT technology"# splitting stringlist_str = test_str.split()count = 0# counting upper casesfor i in list_str: if (i.isupper()): count = count + 1# printing abbreviations countprint ("Number of abbreviations in this sentence is : " + str(count)) |
Output:
Number of abbreviations in this sentence is : 3

