Capitalize the First Letter of Each Word in Python Using title()

(Last Updated On: 13/04/2023)

Python Program to Capitalize the First Letter of Each Word in Python Using title() Function

# Capitalize the First Letter of Each Word in Python Using title()

country=['india','america','england', 'germany']
print('Original List:')
print(country)
country = [i.title() for i in country]
print('List after capitalizing each word:')
print(country)

Output:

Original List:
['india', 'america', 'england', 'germany']
List after capitalizing each word:
['India', 'America', 'England', 'Germany']

Leave a Reply

Your email address will not be published. Required fields are marked *