Q. Write a program that takes a string with multiple words and then capitalizes the first letter of each word and forms a new string out of it.


Answer :-


string = input("Enter a string :- ")
lst = string.split()
for i in lst:
    print (i.capitalize(), end = " ")

Output :-

Enter a string :- path walla portal express
Path Walla Portal Express
>>>

1 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. In the book this code was written in very long format but this code was easy and short too helped me a lot thank you.......

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post