{"id":5398,"date":"2021-05-07T11:14:47","date_gmt":"2021-05-07T05:44:47","guid":{"rendered":"https:\/\/python-programs.com\/?p=5398"},"modified":"2021-11-22T18:42:53","modified_gmt":"2021-11-22T13:12:53","slug":"python-string-isupper-method","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-string-isupper-method\/","title":{"rendered":"Python String isupper() Method"},"content":{"rendered":"
A Python string is a collection of characters surrounded by single, double, or triple quotes. The computer does not understand the characters; instead, it stores the manipulated character as a combination of 0\u2019s and 1\u2019s internally.<\/p>\n
In this article we are going to discuss about isupper() method<\/p>\n
If all of the characters are in upper case, the isupper() method returns True otherwise, it returns False.<\/p>\n
Only alphabet characters are checked, not numbers, symbols, or spaces.<\/p>\n
Syntax:<\/strong><\/p>\n Parameters:<\/strong><\/p>\n Return:<\/strong><\/p>\n Using the isuuper() function, we can determine whether a string is uppercase or lowercase. If all of the string characters are upper case, the function isupper() returns True.<\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n EX-2)<\/strong><\/p>\n Output:<\/strong><\/p>\n Assume we have a string that only contains numbers. Let’s use isupper to see if this string is uppercase or not ().<\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n Assume we have a string that contains numbers and uppercase letters. Let’s use isupper to see if this string is uppercase or not ()<\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n Explanation:<\/strong><\/p>\n As string contains one or more upper case characters but no lower case characters. As a result, isupper() returned True.<\/p>\n Individual characters have no data type in Python. A python string object can also be a single character. As a result, we can use the isupper() method to determine whether a character is upper case or not.<\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n A Python string is a collection of characters surrounded by single, double, or triple quotes. The computer does not understand the characters; instead, it stores the manipulated character as a combination of 0\u2019s and 1\u2019s internally. In this article we are going to discuss about isupper() method String isupper() method in Python isupper() method Checking …<\/p>\ngiven_string.isupper()<\/code><\/p>\n
No parameters are passed<\/pre>\n
If all cased characters in the string are uppercase and there is at least one cased character, this method returns true; otherwise, it returns false.<\/pre>\n
Examples:<\/h3>\n
2)Checking if given string is an uppercase or not<\/h3>\n
# given string\r\nstring = \"BTECHGEEKS\"\r\n# determining whether the given string is uppercase\r\nif(string.isupper()):\r\n print(\"Given string is in uppercase\")\r\nelse:\r\n print(\"Given string is not in uppercase\")\r\n<\/pre>\n
Given string is in uppercase<\/pre>\n
# given string\r\nstring = \"Btechgeeks\"\r\n# determining whether the given string is uppercase\r\nif(string.isupper()):\r\n print(\"Given string is in uppercase\")\r\nelse:\r\n print(\"Given string is not in uppercase\")\r\n<\/pre>\n
Given string is not in uppercase<\/pre>\n
3)Checking if given number string is an uppercase or not<\/h3>\n
# given string\r\nstring = \"28112001\"\r\n# determining whether the given string is uppercase\r\nif(string.isupper()):\r\n print(\"Given string is in uppercase\")\r\nelse:\r\n print(\"Given string is not in uppercase\")\r\n<\/pre>\n
Given string is not in uppercase<\/pre>\n
4)Checking if given string containing letters and numbers an uppercase or not<\/h3>\n
# given string\r\nstring = \"BTECH-28112001\"\r\n# determining whether the given string is uppercase\r\nif(string.isupper()):\r\n print(\"Given string is in uppercase\")\r\nelse:\r\n print(\"Given string is not in uppercase\")\r\n<\/pre>\n
Given string is in uppercase<\/pre>\n
5)Checking if given character is in uppercase or not<\/h3>\n
# given string\r\nstring = \"S\"\r\n# determining whether the given string is uppercase\r\nif(string.isupper()):\r\n print(\"Given char is in uppercase\")\r\nelse:\r\n print(\"Given char is not in uppercase\")\r\n<\/pre>\n
Given char is in uppercase<\/pre>\n
\nRelated Programs<\/strong>:<\/p>\n\n