Python Reference Library →

Python String istitle() Method – Check for Title Case

Let’s look at string istitle() method – check for title case

  1. Notice

    istitle() checks title case across cased words: uppercase or titlecase starts followed by lowercase cased characters.

  2. Try

    Follow the example, change its sample, and compare what happens.

  3. Check

    Explain the result and test your understanding.

Watch how it works

Focus on how the names, objects, and calculations change. We’ll inspect the printed output in the next section.

Explore the idea

Follow the code and watch its state change. Guided simulation.

Code
Python
text = 'Hello World'
result = text.istitle()
print(result)
Live state

Top-level scope

text→Object 1
result→Object 2
Object 1 · str'Hello World'Object 2 · boolTrue
This step

istitle() checks title case across cased words: uppercase or titlecase starts followed by lowercase cased characters.

Picture string istitle() method – check for title case

istitle() checks title case across cased words: uppercase or titlecase starts followed by lowercase cased characters.

Image brief

Alt text
A diagram for Python String istitle() Method – Check for Title Case. Instructions: text = 'Hello World' result = text.istitle() print(result). Displayed result: True. The final example bindings are text --> object 1 (str); result --> object 2 (bool). object 1: 'Hello World'; object 2: True
Image generation prompt
Create a clean educational illustration for a Python programming lesson titled "Python String istitle() Method – Check for Title Case". Teaching focus: istitle() checks title case across cased words: uppercase or titlecase starts followed by lowercase cased characters. Depict exactly the relationships and labels in this reference diagram: EXAMPLE INSTRUCTIONS text = 'Hello World' result = text.istitle() print(result) | v DISPLAYED RESULT True FINAL BINDINGS text --> object 1 (str) result --> object 2 (bool) object 1: 'Hello World' object 2: True Use a flat vector style, generous spacing, clear arrows and legible labels, with a restrained blue/teal palette on a plain background. The diagram must explain the programming idea accurately. Do not depict variables as boxes containing copied objects when they share a reference. Avoid mascots, decorative screenshots, logos, gradients and extra text. Landscape composition, approximately 3:2, suitable for a course card. Accessible description: A diagram for Python String istitle() Method – Check for Title Case. Instructions: text = 'Hello World' result = text.istitle() print(result). Displayed result: True. The final example bindings are text --> object 1 (str); result --> object 2 (bool). object 1: 'Hello World'; object 2: True

Follow the execution

Choose a different sample input, then follow every step through to the output. Before revealing it, predict what the program will display.

Execution workspace

Choose a sample and follow its execution. Guided simulation.

Code
Python
text = 'Hello World'
result = text.istitle()
print(result)
Live state

Top-level scope

text→Object 1
result→Object 2
Object 1 · str'Hello World'Object 2 · boolTrue
This step

The example has finished. Compare the final output with the values and references above.

Terminal
Output
True

What do you expect this program to print?

What does this example display?

text = 'Hello World'
result = text.istitle()
print(result)
What does this example display?
Choose one answer. You can try again.

Answer and explanation

True

Follow the printed values in order. The output is: True

Which explanation matches what you learned?

Which explanation matches what you learned?
Choose one answer. You can try again.

Answer and explanation

istitle() checks title case across cased words: uppercase or titlecase starts followed by lowercase cased characters.

istitle() checks title case across cased words: uppercase or titlecase starts followed by lowercase cased characters.

More examples and reference

Python String istitle() Method

The istitle() method in Python checks whether each word in a string starts with an uppercase letter followed by lowercase letters. It returns True if the string is in title case.

Syntax

string.istitle()

Returns:

  • True – if all words are title-cased
  • False – otherwise

Example 1: Valid Title Case

text = "Hello World"
print(text.istitle())
True

Example 2: Not a Title Case

text = "hello world"
print(text.istitle())
False

Example 3: Mixed Case

text = "Hello world"
print(text.istitle())
False

Use Cases

  • Validating titles or headers in a document
  • Checking formatting before applying transformations
  • Filtering data for properly capitalized phrases

Important Notes

  • Only alphabetic characters are considered. Numbers or symbols don't affect the result.
  • Empty strings return False.

Common Mistake

Words like "The USA" are not in title case (because "USA" is in all caps), so istitle() will return False.

Practice Problem

Write a program that reads a line of text from the user and checks if it's in title case:

text = input("Enter a sentence: ")
if text.istitle():
    print("The text is in title case.")
else:
    print("The text is NOT in title case.")

Summary

  • string.istitle() checks if each word starts with a capital letter.
  • Returns True for title case, False otherwise.
  • Commonly used for validation in formatting.

What to remember

Connect what you noticed in the example with the idea below.

Remember

istitle() checks title case across cased words: uppercase or titlecase starts followed by lowercase cased characters.

Watch out for this idea

istitle() only checks the first character of the entire string.

This is the misconception to avoid.

Reference checks are optional and do not count toward course progress.

    Reference library →