 
                 
                InterviewSolution
 Saved Bookmarks
    				| 1. | Write Python script 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 = raw_input (“Enter a string :”) length = len (string) a = 0 end – length string 2 = ” # empty string while a < length if a == 0 string 2 += string [0].upper() a += 1 elif (string [a] = = ‘ ‘ and string [a+1) !=”) : string 2 + = string [a] string 2 + = string [a+l].upper( ) a + = 2 else : string 2 + = string [a] a + = 1 print “Original string :”, string print “Converted string :”, string2 | |