1# To capitalize the first letter in a word or each word in a sentence use .title()
2name = tejas naik
3print(name.title()) # output = Tejas Naik
4
1>>> "hello world".title()
2'Hello World'
3>>> u"hello world".title()
4u'Hello World'
5
1def decapitalize(str):
2 return str[:1].lower() + str[1:]
3
4print( decapitalize('Hello') ) # hello
1 "hello world".title()
2'Hello World'
3>>> u"hello world".title()
4u'Hello World'
1 singers = ['johnny rotten', 'eddie vedder', 'kurt kobain', 'chris cornell', 'micheal phillip jagger']
2 singers = [singer.capitalize() for singer in singers]
3 print(singers)
4
5 #instead of capitalize use title() to have each word start with capital letter
1# Use title() to capitalize the first letter of each word in a string.
2name = "elon musk"
3print(name.title())
4# Elon Musk