×

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

Important Difference between Python 2.x and Python 3.x with Example

The comparison between Python 2 and Python 3 is given in the article that follows. Python is a computer language that can perform more tasks than other languages and is...

5 minutes read.

Parameter Passing in Python

In Python, when we characterize capabilities with default values for specific boundaries, it is said to have its contentions set as a possibility for the client. Clients can either pass their...

3 minutes read.

Python set()

Python set() Class The set() class in Python returns a new set object, optionally with elements taken from iterable.  Syntax class set([iterable]) Parameter iterable : This parameter represents a sequence, collection or an iterator object Return This function returns a...

1 minute read.

Artificial intelligence mini projects ideas in python

Artificial intelligence "The human race started from the invention of the wheel", and today we are about to advance to the Industrial level 4.0, where machines can work, talk, think and...

6 minutes read.

AES CTR Python

Python Programming Language  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...

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.

Python Fit Transform

In machine learning, fit (), transform(), fit transform () methods are provided by scikit learn package. This package is used in model fitting and data processing. These methods are implemented...

2 minutes read.

Python e-book free download

Python is a booming language these days. It has many applications for making code easier; it is also an open-source language. There are many sources to learn python. In this...

3 minutes read.

Self in Python

 “self" is neither a keyword nor has a special meaning in Python, but it has a place and a job to do in Object-oriented programming. When we create a class...

6 minutes read.

Python List reverse() method

 Python List reverse() method The list.reverse () method in Python reverses the elements of the list in place. Syntax list.reverse() Parameter NA Example 1 # Python program explaining # the list.reverse() method weekList = ['Sun','Thurs','Mon','Fri', 'Tues', 'Wed'] print("Actual week list: ",weekList) #...

1 minute read.

Python Arithmetic Operators

An arithmetic operator is a mathematical operator that is used to operate on two operands. Based on the operator used, action is performed on the operands, and output is delivered. Following...

3 minutes read.

Python Ways to find nth occurrence of substring in a string

Introduction In Python, a string is a collection of characters that can be employed to conduct additional operations. In Python, a substring is a group of characters that are a part...

4 minutes read.

Python PPTX

Python-pptx is a python library that enables the user to create and update PowerPoint (.pptx) presentations. It is used to create modified PowerPoint presentations from the db content that can...

10 minutes read.

_dict_ in Python

An unordered collection of data values known as a dictionary can be used in Python to store data values similar to a map. Dictionaries can also store a key: value...

6 minutes read.

Python Infinity

Introduction We will discover how to define an infinite number in Python in this tutorial. Infinity, as we all know, is a value that cannot be defined and can either be...

5 minutes read.

Python Set issuperset() method

Python Set issuperset() method The set.issuperset() method in Python returns a boolean value True if all items in the specified set exists in the original set, else it returns False. Syntax set.issuperset (set1) Parameter set- This parameter represents the...

2 minutes read.

Python email utils

Python is a popular programming language in this growing world. There are many resources to learn python online without spending a single penny. In this article, we will talk about a...

4 minutes read.

Python Operator Precedence

Before knowing about the operator precedence in Python, we have to know about the operators in Python. So let's have a look at it. According to one definition, the operator is...

3 minutes read.

Python And Operator

Python's and operator takes two operands that can be either object, Boolean expressions, or both. And operator creates more complex expressions using those operands. Conditions are the common name for...

8 minutes read.

Insertion Sort using Python

Insertion sort is a type of sorting technique that is used for sorting an array with random elements. Using sorting methods, any unsorted array can be sorted into ascending or...

3 minutes read.