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 Comprehension
Python Program to Return Multiple Values From a Function
JavaScript Methods of RegExp and String
Python Program to Iterate Over Dictionaries Using for Loop
Deep Learning with Python - Francois Chollet
Python Program to Print Output Without a Newline
Python Program to Get the Full Path of the Current Working Directory
Python Program to Iterate Through Two Lists in Parallel
Python Program to Find the Largest Among Three Numbers
Python Global, Local and Nonlocal variables
Python String strip()
Python String swapcase()
Python Program to Find the Square Root
Python Program to Count the Number of Occurrence of a Character in String
Python Operators
Python String istitle()
Python String isdigit()
Python setattr()
Machine Learning with Python for everyone - Mark E.Fenner
Python String expandtabs()
Java Program to Permute All Letters of an Input String
Python File I/O Operation
Python Errors and Built-in Exceptions
Python String isdecimal()
Python frozenset()
Deep Learning with Python - A Hands-on Introduction - Nikhil Ketkar
Python String isnumeric()
Python Program to Check If a String Is a Number (Float)
Python Variables, Constants and Literals
Python Set union()
Python Program to Shuffle Deck of Cards
Python Program to Count the Number of Each Vowel