{"id":24614,"date":"2021-10-23T09:09:46","date_gmt":"2021-10-23T03:39:46","guid":{"rendered":"https:\/\/python-programs.com\/?p=24614"},"modified":"2021-11-05T19:13:52","modified_gmt":"2021-11-05T13:43:52","slug":"python-string-istitle-method-examples","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-string-istitle-method-examples\/","title":{"rendered":"Python String istitle() Method with Examples"},"content":{"rendered":"
In the previous article, we have discussed Python String isspace() Method Examples<\/a> If the string is titlecased, the istitle() function returns True. If it does not, it returns False.<\/p>\n Syntax:<\/strong><\/p>\n Parameters: <\/strong>This function has no parameters.<\/p>\n Return Value:<\/strong><\/p>\n The istitle() method gives:<\/p>\n Examples:<\/strong><\/p>\n Example1:<\/strong><\/p>\n Input:<\/strong><\/p>\n Output:<\/strong><\/p>\n Example2:<\/strong><\/p>\n Input:<\/strong><\/p>\n Output:<\/strong><\/p>\n Approach:<\/strong><\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n Approach:<\/strong><\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n Are you facing difficulties in finding all the methods that a string object can call in python? Have a glance at this Python String Method Examples<\/a> Tutorial & meet such challenges with ease.<\/p>\n In the previous article, we have discussed Python String isspace() Method Examples istitle() Method in Python: If the string is titlecased, the istitle() function returns True. If it does not, it returns False. Syntax: string.istitle() Parameters: This function has no parameters. Return Value: The istitle() method gives: True if the string is titlecased. If the …<\/p>\n
\n istitle() Method in Python:<\/strong><\/p>\nstring.istitle()<\/pre>\n
\n
Given string = 'Welcome To Python-Programs'\r\nGiven string = 'good morning btechgeeks'\r\nGiven string = 'Hello All @ This Is Btechgeeks'<\/pre>\n
The given string = Welcome To Python-Programs\r\nChecking if the given string is titlecased or not = True\r\nThe given string = good morning btechgeeks\r\nChecking if the given string is titlecased or not = False\r\nThe given string = Hello All @ This Is Btechgeeks\r\nChecking if the given string is titlecased or not = True<\/pre>\n
Given string = 'Welcome To Python-programs'\r\nGiven string = '12345 Hello All'\r\nGiven string = 'GOOD MORNING BTECHGEEKS'<\/pre>\n
The given string = Welcome To Python-programs\r\nChecking if the given string is titlecased or not = False\r\nThe given string = 12345 Hello All\r\nChecking if the given string is titlecased or not = True\r\nThe given string = GOOD MORNING BTECHGEEKS\r\nChecking if the given string is titlecased or not = False<\/pre>\n
String istitle() Method Examples in Python<\/h2>\n
\n
Method #1: Using Built-in Functions (Static Input)<\/h3>\n
\n
# Give the string as static input and store it in a variable.\r\ngvn_strng1 = 'Welcome To Python-Programs'\r\n# Apply istitle() function to the given string in which if the string\r\n# is titlecased, the istitle() function returns True. If it does not,\r\n# it returns False.\r\n# Store it in another variable.\r\nrslt_1 = gvn_strng1.istitle()\r\n# Print the above-given String.\r\nprint(\"The given string = \", gvn_strng1)\r\n# Print the result after checking if the given string is titlecased or not\r\nprint(\"Checking if the given string is titlecased or not = \", rslt_1)\r\n# Similarly, do the same for other strings and print the result.\r\ngvn_strng2 = 'good morning btechgeeks'\r\nrslt_2 = gvn_strng2.istitle()\r\nprint(\"The given string = \", gvn_strng2)\r\nprint(\"Checking if the given string is titlecased or not = \", rslt_2)\r\n\r\ngvn_strng3 = 'Hello All @ This Is Btechgeeks'\r\nrslt_3 = gvn_strng3.istitle()\r\nprint(\"The given string = \", gvn_strng3)\r\nprint(\"Checking if the given string is titlecased or not = \", rslt_3)\r\n<\/pre>\n
The given string = Welcome To Python-Programs\r\nChecking if the given string is titlecased or not = True\r\nThe given string = good morning btechgeeks\r\nChecking if the given string is titlecased or not = False\r\nThe given string = Hello All @ This Is Btechgeeks\r\nChecking if the given string is titlecased or not = True<\/pre>\n
Method #2: Using Built-in Functions (User Input)<\/h3>\n
\n
# Give the string as user input using the input() function and store it in a variable.\r\ngvn_strng1 = input(\"Enter some Random String = \")\r\n# Apply istitle() function to the given string in which if the string\r\n# is titlecased, the istitle() function returns True. If it does not,\r\n# it returns False.\r\n# Store it in another variable.\r\nrslt_1 = gvn_strng1.istitle()\r\n# Print the above-given String.\r\nprint(\"The given string = \", gvn_strng1)\r\n# Print the result after checking if the given string is titlecased or not\r\nprint(\"Checking if the given string is titlecased or not = \", rslt_1)\r\n# Similarly, do the same for other strings and print the result.\r\ngvn_strng2 = input(\"Enter some Random String = \")\r\nrslt_2 = gvn_strng2.istitle()\r\nprint(\"The given string = \", gvn_strng2)\r\nprint(\"Checking if the given string is titlecased or not = \", rslt_2)\r\n\r\ngvn_strng3 = input(\"Enter some Random String = \")\r\nrslt_3 = gvn_strng3.istitle()\r\nprint(\"The given string = \", gvn_strng3)\r\nprint(\"Checking if the given string is titlecased or not = \", rslt_3)\r\n\r\n<\/pre>\n
Enter some Random String = Welcome To Python-programs\r\nThe given string = Welcome To Python-programs\r\nChecking if the given string is titlecased or not = False\r\nEnter some Random String = 12345 Hello All\r\nThe given string = 12345 Hello All\r\nChecking if the given string is titlecased or not = True\r\nEnter some Random String = GOOD MORNING BTECHGEEKS\r\nThe given string = GOOD MORNING BTECHGEEKS\r\nChecking if the given string is titlecased or not = False<\/pre>\n
\n