Reference Materials
Certification Courses
Created with over a decade of experience and thousands of feedback.
Python online compiler
JavaScript online compiler
SQL online compiler
Java online compiler
HTML online compiler
C online compiler
C++ online compiler
C# online compiler
PHP online compiler
Swift online compiler
Kotlin online compiler
TypeScript online compiler
Go online compiler
Rust online compiler
Scala online compiler
Dart online compiler
R online compiler
Ruby online compiler
Python String istitle()
The istitle() returns True if the string is a titlecased string. If not, it returns False.
The syntax of istitle() method is:
string.istitle()
istitle() Parameters
The istitle() method doesn't take any parameters.
Return Value from istitle()
The istitle() method returns:
Trueif the string is a titlecased stringFalseif the string is not a titlecased string or an empty string
Example 1: Working of istitle()
s = 'Python Is Good.'
print(s.istitle())
s = 'Python is good'
print(s.istitle())
s = 'This Is @ Symbol.'
print(s.istitle())
s = '99 Is A Number'
print(s.istitle())
s = 'PYTHON'
print(s.istitle())
Output
True False True True False
Example 2: How to use istitle()?
s = 'I Love Python.'
if s.istitle() == True:
print('Titlecased String')
else:
print('Not a Titlecased String')
s = 'PYthon'
if s.istitle() == True:
print('Titlecased String')
else:
print('Not a Titlecased String')
Output
Titlecased String Not a Titlecased String
Also Read:
Did you find this article helpful?