Table of Contents
The string isupper() method returns whether or not all characters in a string are uppercased or not.
The syntax of isupper() method is:
string.isupper()
1. String isupper() Parameters
The isupper() method doesn’t take any parameters.
2. Return value from String isupper()
The isupper() method returns:
- True if all characters in a string are uppercase characters
- False if any characters in a string are lowercase characters
3. Example 1: Return value of isupper()
# example string string = "THIS IS GOOD!" print(string.isupper()); # numbers in place of alphabets string = "THIS IS ALSO G00D!" print(string.isupper()); # lowercase string string = "THIS IS not GOOD!" print(string.isupper());
Output
True True False
4. Example 2: How to use isupper() in a program?
string = 'THIS IS GOOD'
if string.isupper() == True:
print('Does not contain lowercase letter.')
else:
print('Contains lowercase letter.')
string = 'THIS IS gOOD'
if string.isupper() == True:
print('Does not contain lowercase letter.')
else:
print('Contains lowercase letter.')
Output
Does not contain lowercase letter. Contains lowercase letter.
Related posts:
Python List reverse()
Python Program to Sort Words in Alphabetic Order
Python Program to Check the File Size
Python Object Oriented Programming
Python Program to Convert Kilometers to Miles
Python Program to Find the Size (Resolution) of a Image
Python Objects and Classes
Python String isalnum()
Python reversed()
Python Program to Differentiate Between type() and isinstance()
Python Program to Convert Decimal to Binary Using Recursion
Python timestamp to datetime and vice-versa
Python Program to Add Two Matrices
Python Program to Calculate the Area of a Triangle
Python Program to Make a Simple Calculator
Python Dictionary setdefault()
Python String lower()
Python slice()
Python Program to Create a Long Multiline String
Python min()
Python Program to Print all Prime Numbers in an Interval
Python List clear()
Python object()
Python Program to Display Powers of 2 Using Anonymous Function
Reading an HTTP Response Body as a String in Java
Python memoryview()
Deep Learning with Python - Francois Cholletf
Python Decorators
Python zip()
Python Program to Check if a Key is Already Present in a Dictionary
Python Type Conversion and Type Casting
Python sorted()