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:
Java String Conversions
Python property()
String Initialization in Java
Deep Learning with Python - A Hands-on Introduction - Nikhil Ketkar
Python Program to Compute the Power of a Number
Python Program to Check if a Number is Positive, Negative or 0
Python Program to Convert Decimal to Binary Using Recursion
Python Program to Find Sum of Natural Numbers Using Recursion
Learning scikit-learn Machine Learning in Python - Raul Garreta & Guillermo Moncecchi
Python Program to Find HCF or GCD
Python Closures
Python RegEx
Python String isdecimal()
Python Get Current time
Python Program to Merge Mails
Python Dictionary popitem()
Machine Learning Mastery with Python - Understand your data, create accurate models and work project...
Python vars()
Java – Reader to String
Python float()
Python Program to Catch Multiple Exceptions in One Line
Python chr()
Python strptime()
Python Set isdisjoint()
Python Generators
Converting String to Stream of chars
Python Program to Print the Fibonacci sequence
Python Program to Get the Class Name of an Instance
Python Keywords and Identifiers
Python Operators
Natural Language Processing with Python - Steven Bird & Ewan Klein & Edward Loper
Python String title()