×

Python String isupper() method

Python String isupper() method

The String.isupper() method in Python returns a boolean value ‘true’ if all cased characters in the string are uppercase else for any other value is returns false.

Syntax

String.isupper()

Parameter

NA

Return

This method returns a Boolean value true if all the characters in the specified string are uppercased else it returns false.

Example 1

 # Python program explaining
 # the string.isupper() method
 # initializing the string value
 string = 'TUTORIALSANDEXAMPLES'
 print("String 1:",string)
 print("The above string is upper cased:",string.isupper()) 
  #initializing second string value
 string = 'TutorialsAndEXAMPLES'
 print("String 2:",string)
 print("The above string is upper cased:",string.isupper()) 

Output

 String 1: TUTORIALSANDEXAMPLES
 The above string is upper cased: True
 String 2: TutorialsAndEXAMPLES
 The above string is upper cased: False 

Example 2

 # Python program explaining
 # the string.isupper() method
 # initializing the string value
 string = "PYTHON IS AN EASY PROGRAMMING LANGUAGE"
 print("String 1:",string)
 if string.isupper() == True:
   print('The above string does not contain a lowercase letter.\n')
 else:
   print('The above string contains a uppercase letter.\n')
 string = "It IS VERY SIMPLE TO EXCEcute"
 print("String 2:",string)
 if string.isupper() == True:
   print('The above string does not contain a lowercase letter.')
 else:
   print('The above string contains a lowercase letter.') 

Output

 String 1: PYTHON IS AN EASY PROGRAMMING LANGUAGE
 The above string does not contain a lowercase letter.
 String 2: It IS VERY SIMPLE TO EXCEcute
 The above string contains lowercase letter. 

Example 3

 # Python program explaining
 # the string.isupper() method
 # initializing the string value
 string = "PYTHON IS AN EASY PROGRAMMING LANGUAGE"
 print(string.isupper())
 # passing special characters
 string = "!@#HELLOWORLD"
 #return true the letters in the string are in uppercase
 print(string.isupper())
 # passing whitespace
 string = "HELLO WORLD"
 #return true the letters in the string are in uppercase
 print(string.isupper())
 # passing integer values in the string
 string = "HELLO123 WORLD123"
 #return true the letters in the string are in uppercase
 print(string.isupper())
 string = "HellO123 WORLD123"
 #return false the some letters in the string are in lowercase
 print(string.isupper()) 

Output

 True
 True
 True
 True
 False 

Related Topics

Create a Table Using Tkinter in Python

Tkinter: The standard Python technique for building Graphical User Interfaces (GUIs) is Tkinter, which is included in all popular Python distributions. The only framework included in the Python standard library is...

3 minutes read.

How to Read html page in python

Html is a Hyper Text Markup language is a standard language used for creating webpages. HTML is the name of the language used to describe the construction of Web pages....

4 minutes read.

Unit Testing in Python

The process of testing whether a particular unit is working properly or not is called “UNIT TESTING”. A unit test will check small components in your application. The first and...

7 minutes read.

Python lock

Before understanding the concept of Python-lock we need to understand what kind if condition we require to implement the locks in Python. Let us start with multithreading and its implementation...

5 minutes read.

Python Parser

Introduction : Parsing is referred to as the processing and translation of a Python program into machine language. In general, we could indeed say that the command parse is used to...

4 minutes read.

How to Declare a Variable in Python?

The concept of constants and variables is something that we are studying right from our primary classes. We know that constants are the fixed values whereas variables are those whose...

4 minutes read.

Python program to find the GCD or HCF

Python program to find the GCD or HCF The largest positive integer that perfectly divides the two numbers is the HCF (Highest Common Factor) or GCD (Greatest Common Deviser). For example,...

5 minutes read.

List Subtract in Python

The List is one of the most unique Data Structures in Python. It is generally used to store multiple values in just one single variable. It is one of the...

4 minutes read.

How to get current date in python?

How to get current date in python? In Python programming language, date and time are not just a data form, but it is possible to import a method called datetime to operate...

3 minutes read.

Python MongoDB Tutorial

An Introduction to MongoDB MongoDB is a document-oriented database application. It is an Open-source and platform-independent program. MongoDB is similar to few NoSQL databases that store the data in the documents...

17 minutes read.

Explain sklearn clustering in Python

Make a connection and patterns across datasets by using clustering, one of the unsupervised machine learning approaches. Grouping is crucial because it ensures unlabelled data's natural clustering. The sample from...

7 minutes read.

Global variables in python

In Python, considering the scope, variables are categorized into global and local variables. In this article, we will discuss these two types along with examples. Any variable holds a value in...

4 minutes read.

Python vs PHP

Python Python is a high-level, object-oriented, interpreted language that is used to create independent program and algorithms for a variety of applications. It has a large library support base. In 1990,...

3 minutes read.

Python Multithreading

In python, we can implement multithreading. In this tutorial, we will understand the basics of implementing multithreading in a python programming language. Multithreading is just like multiprocessing. We use it...

4 minutes read.

Python maketrans() function

Introduction A static method is the string maketrans() one. It is used to make a one-to-one mapping between a string's character and its translation, i.e., to define the list of characters...

5 minutes read.

Exrex Python

Python: Python is an interactive and more accessible language than any other programming language. The python programming language uses a variety of libraries to perform the operations in a faster...

4 minutes read.

Python hex() function

Python hex() function The hex() function in Python  converts the specified number into a hexadecimal value. Syntax hex(x) Parameter x: The parameter represents an Integer value. Return This function Returns hexadecimal string. Example 1 # Python Program explaining # the hex() function print("The...

1 minute read.

Python List Size

Introduction The list data type in Python is an ordered, flexible collection. A list may also contain duplicate entries. To get the size of any object, use the len() function in...

6 minutes read.

Python String expandtabs() method

Python String expandtabs() method The string.expandtabs() method in Python returns a copy of the string where all tab characters are expanded using spaces. Syntax String.expandtabs([tabsize]) Parameter tabsize: This parameter specifies the number of characters to...

1 minute read.

Python property()

Python property() class The property() class in Python returns a property attribute. Syntax class property(fget=None, fset=None, fdel=None, doc=None) Parameter fget: This attribute is used for getting an attribute value. fset : This parameter sets an attribute value. fdel: It is a function for deleting...

1 minute read.