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

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']

About The Author

Leave a Reply