Use the title()
method to transform the first letter in each word into upper case and the rest of characters into lower case.
regular_text = "This is a regular text."
title_case_text = regular_text.title()
print(regular_text)
#This is a regular text.
print(title_case_text)
#This Is A Regular Text.
Notice that the original regular_text
variable remains unchanged, thus you need to assign the return of the method to a new variable, title_case_text
in this case.