String in Python has built-in functions for almost every action to be performed on a string. Python String isupper() function checks if all the characters in a string are uppercase then returns true else false.
Key Points :
- Return Type: Boolean i.e. True or False
- Parametric Values: No Parameters required
- It is not space-sensitive but case sensitive
- Empty String also returns False.
String isupper() Syntax
str_name.isupper()
The str_name here refers to the input string. And, isupper() is inbuilt string function in python.
str_name = "WELCOME" print(str_name.isupper()) # True
String isupper() Examples
Different cases are given below.
Case 1: Every character in a string is uppercase also contains whitespaces/numbers/special characters
str_name = "WELCOME PYTHON USER" print(str_name.isupper()) # True str_name = "WELCOME 2019" print(str_name.isupper()) # True str_name = "WELCOME @ 2020" print(str_name.isupper()) # True
Case 2: String contains only numbers or special characters
str_name = "2020" print(str_name.isupper()) # False str_name = "@$&" print(str_name.isupper()) # False
Case 3: Every character in a string is lowercase also contains whitespaces/numbers/special characters
str_name = "welcome python user" print(str_name.isupper()) # False str_name = "welcome 2019" print(str_name.isupper()) # False str_name = "welcome @ 2020" print(str_name.isupper()) # False
Case 4: Only the first character of every word is uppercase also contains whitespaces/numbers/special characters
str_name = "Welcome" print(str_name.isupper()) # False str_name = "Welcome Python User" print(str_name.isupper()) # False str_name = "Welcome 2019" print(str_name.isupper()) # False str_name = "Welcome @ 2020" print(str_name.isupper()) # False
Case 5: String is Empty
str_name = ' ' print(str_name.isupper()) # False
Program to Print List of All Possible Uppercase Characters in Python
The Unicode module can be used to check the uppercase characters. The program is to print all uppercase Unicode characters.
import unicodedata total_count = 0 for i in range(2 ** 16): charac = chr(i) if charac.isupper(): print(u'{:04x}: {} ({})'.format(i, charac, unicodedata.name(charac, 'UNNAMED'))) total_count = total_count + 1 print("Total Count of Unicode UPPERCASE Characters = ",total_count)

It is just a glance of output as the actual output is lengthy. There are 999 Uppercase characters in Unicode.