python lowercase first letter 1

python lowercase first letter

# To capitalize the first letter in a word or each word in a sentence use .title()
name = tejas naik
print(name.title())    # output = Tejas Naik

Here is what the above code is Doing:
1. We create a variable named name and assign it the value ‘tejas naik’.
2. We print the value of name, calling the title() method on it.
3. The title() method capitalizes the first letter of each word in name.

Similar Posts