my_str.istitle()
Returns True
if all words in a string starts with upper case letter , otherwise returns False
my_str='Welcome To Python'
print(my_str.istitle()) # Output is True
my_str='Welcome to Python'
print(my_str.istitle()) # Output is False
my_str='WELCOME TO PYTHON'
print(my_str.istitle()) # Output is False ( All letters in Upper case )
my_str='Welcome to python'
print(my_str.istitle()) # False ( All words are not starting with upper case)
my_str='100 Welcome'
print(my_str.istitle()) # True
my_str = "123 Welcome"
print(my_str.istitle()) # Output: True (numbers don't affect title case)
title = input("Enter title: ")
if title.istitle():
print("Title is correctly formatted")
else:
print("Incorrect title format")
my_str = "Hello World"
print(my_str.istitle()) # Output: True
my_str = "hello World"
print(my_str.istitle()) # Output: False (First word is lowercase)
my_str = "Python@3 Rocks!"
print(my_str.istitle()) # Output: True (Special characters are ignored)
my_str = "Python@rocks"
print(my_str.istitle()) # Output: False (Rocks is not title-cased)
empty_str = ""
print(empty_str.istitle()) # Output: False
Author
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.