Python isupper() method
In Python, isupper() is a built-in method used for string handling. This method returns True if all characters in the string are uppercase, otherwise, returns “False”.
This function is used to check if the argument contains any uppercase characters such as :
ABCDEFGHIJKLMNOPQRSTUVWXYZ
Syntax :
string.isupper() Parameters: isupper() does not take any parameters Returns :
- True- If all characters in the string are uppercase.
- False- If the string contains 1 or more non-uppercase characters.
Examples:
Input : string = 'GEEKSFORGEEKS' Output : True Input : string = 'GeeksforGeeks' Output : False
Errors And Exceptions
- It returns “True” for whitespaces but if there is only whitespace in the string then returns “False”.
- It does not take any arguments, Therefore, It returns an error if a parameter is passed.
- Digits and symbols return “True” but if the string contains only digits and numbers then returns “False”
# Python code for implementation of isupper() # checking for uppercase characters string = 'GEEKSFORGEEKS' print (string.isupper()) string = 'GeeksforGeeks' print (string.isupper()) |
Output:
True False
Last Updated on July 24, 2021 by admin