×

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

Copying a file from one folder to Another with Python

In this article, we shall discuss copying a file from one folder to another using python functions. A file is a collection of data or information stored on a computer....

3 minutes read.

Poolmanager in 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 way....

4 minutes read.

Append key Value to Dictionary in Python

The Python dictionary is one of the built-in data types. Elements of dictionaries are key-value pairs. In Python, there are numerous ways to add dictionaries. Let's examine some of the...

9 minutes read.

Python String lower() method

Python String lower() method The string.lower() method in Python returns a string where all characters are lower case. Syntax string.lower() Parameter NA Return This method returns a string where all characters are lower case. Example 1 # Python...

1 minute read.

Python String isspace() method

Python String isspace() method The string.isspace() method returns a Boolean value true if there are only whitespace characters in the given string. This function is used to check if the given...

2 minutes read.

Python complex() class

Python complex() class The complex() class in Python returns a complex number or converts a string or number to a complex number. Syntax class complex([real[, imag]]) Parameter Real: This parameter consists of a number representing the real...

1 minute 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 locals() function

Python locals() function The locals() function in Python updates and returns a dictionary representing the current local symbol table. Syntax locals() Parameter NA Return This function returns the local symbol table as a dictionary or returns free...

1 minute read.

CSV Write in Python

What is meant by CSV? CSV stands for Comma Separated Values. The name itself defines its purpose. CSV arranges the data in the form of tables and stores the organized data in...

3 minutes read.

Is Python Case-sensitive when Dealing with Identifiers

Yes, Python is a case-sensitive language while dealing with identifiers. Python is one of the top trending, widely-used programming languages. Python is a general-purpose programming language. It is a case-sensitive...

6 minutes read.

Python Dictionary items() method

Python Dictionary items() method The dictionary.items() method in Python returns a view object that displays a list of dictionary's (key, value) tuple pairs. Syntax dictionary.items() Parameter NA Return This method returns a view object, displaying the list...

1 minute read.

Python Data Structures

Python Data Structures: Python is a programming language used worldwide for various fields such as building dynamic websites, artificial intelligence and many more. However, there is data that plays a...

18 minutes read.

Python slice()

Python slice() class The slice() class return a slice object representing the set of indices specified by range(start, stop, step).  Syntax class slice(stop)          or class slice(start, stop[, step]) Parameter Start: This parameter represents an integer number specifying at...

1 minute read.

Python Rest API

In this tutorial, we will understand the meaning of API and REST API. We will understand the working of REST API. We will then realize the boundaries of architecture defined...

4 minutes read.

Python OOPs: Class, Object, Inheritance and Constructor

Basic Object-Oriented Programming (OOP) Concepts in Python Python is similar to most general-purpose programming languages with an Object-Oriented environment system since its existence. Being an Object-Oriented Programming language, Python provides ease...

9 minutes read.

Data Class in Python

Introduction In Python 3.7, the dataclass modules are introduced as a practical tool for creating organized classes designed specifically for data storage. These classes contain specific attributes and capabilities to deal...

6 minutes read.

Python min() function

Python min() function returns you the minimum value element in an iterable. We can also use this function to determine the smallest value among various arguments passed to this function. We...

4 minutes read.

Rank Based Percentile GUI Calculator using PyQt5 in Python

PyQt5: PyQt5 is one of several solutions that Python offers for creating GUI applications. Cross-platform GUI toolkit PyQt5 is a collection of Python interfaces for Qt version 5. With the capabilities...

3 minutes read.

Imread Python

In this walkthrough, we'll go over the specifics of using the imread() method of OpenCV-Python and various methods for loading images. Imread is an Image reading library. One of the most helpful...

7 minutes read.

any() Keyword in python

“any” keyword in python This page contains all the information about any () Keyword in python, how it is used with lists, tuples, dictionaries, sets, and what its function is? Python...

3 minutes read.