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 Dictionary
Python Deeper Insights into Machine Learning - Sebastian Raschka & David Julian & John Hearty
Python Program to Check if a Number is Positive, Negative or 0
Python Program to Create a Countdown Timer
Python Set issubset()
Python frozenset()
Python String center()
Python for Programmers with introductory AI case studies - Paul Deitel & Harvey Deitel
Python time Module
Python String isidentifier()
Python String rindex()
Python Package
Python zip()
Python reversed()
Python Data Analytics with Pandas, NumPy and Matplotlib - Fabio Nelli
Deep Learning with Python - A Hands-on Introduction - Nikhil Ketkar
Python Program to Display Fibonacci Sequence Using Recursion
Python isinstance()
Python List pop()
Format ZonedDateTime to String
Python iter()
Python Objects and Classes
Python String isdigit()
Python Program to Solve Quadratic Equation
Python Set clear()
Python Dictionary copy()
Python del Statement
Python String format_map()
Python repr()
Python RegEx
Python Program to Get the File Name From the File Path
Python Program to Display Calendar