+3 votes
in Class 11 by kratos

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.

1 Answer

+6 votes
by kratos
 
Best 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

...