Python String istitle Method - Python Tutorial | Logic Practice
Python Course / Data Types / Python String istitle Method

Python String istitle Method

BLUF: This lesson on Python String istitle Method provides a comprehensive guide to understanding and implementing this concept in Python. Whether you're a beginner or looking to refresh your knowledge, you'll find clear explanations and interactive code examples here.
Key Concept: Python String istitle Method

Mastering Python String istitle Method is essential for building efficient Python applications. Focus on the syntax and the best practices highlighted in this tutorial.

The Python method istitle checks whether a string is formatted in title case, returning True if it is, and False if it is not.

Syntax of Python String istitle Method

It has the following syntax:

Example

istitle()

Parameters

No parameter is required.

Return

It returns either True or False.

Different Examples for Python String istitle Method

Let’s explore a few examples of the istitle method to grasp its capabilities.

Example 1

This is a straightforward illustration to comprehend the Python String istitle Method.

Example

# Python istitle() method example

# Variable declaration

str = "Welcome To Example"

# Calling function

str2 = str.istitle()

# Displaying result

print(str2)

Example 2

Let's consider another example to illustrate the functionality of the Python String istitle Method.

Example

# Python istitle() method example

# Variable declaration

str = "Welcome To Example" # True

# Calling function

str2 = str.istitle()

# Displaying result

print(str2)

str = "hello logicpractice"    # False

str2 = str.istitle()

print(str2)

Output:

Output

True

False

Example 3

Let's consider an example to illustrate the functionality of the Python String istitle method.

Example

# Python istitle() method example

# Variable declaration

str = "ab cd ef"

if str.istitle() == True:

    print("In title case")

else:

    print("Not in tit0le case")

str = "Ab Cd Ef"

if str.istitle() == True:

    print("In title case")

else:

    print("Not in title case")

str = "1b 2d 3f"

if str.istitle() == True:

    print("In title case")

else:

    print("Not in title case")

Output:

Output

Not in title case

In title case

Not in title case

Input Required

This code uses input(). Please provide values below:

Logic Practice
Install Logic Practice
Add to home screen for a faster app-like experience