Computer Science, asked by RudeGirl123, 11 months ago

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.

Answers

Answered by AbhijithPrakash
33
  1. string = input("Enter a string:")
  2. length = len(string)
  3. a = 0
  4. end = length
  5. string2=''             #empty string
  6. while a < length :
  7.    if a == 0:
  8.        string2 += string[0].upper()
  9.        a += 1
  10.    elif (string[a] =='' and string[a+1] !=''):
  11.        string2 += sting[a]
  12.        string1 += string[a+1].upper()
  13.        a += 2
  14.    else :
  15.        string2 += string[a]
  16.        a += 1
  17. print("Original String:", string)
  18. print("Capitalized words String", string2)

RudeGirl123: help me in
https://brainly.in/question/9753192
also
Answered by sumitkumar724800
12

string = input("Enter a string:")

length = len(string)

a = 0

end = length

string2=''             #empty string

while a < length :

   if a == 0:

       string2 += string[0].upper()

       a += 1

   elif (string[a] =='' and string[a+1] !=''):

       string2 += sting[a]

       string1 += string[a+1].upper()

       a += 2

   else :

       string2 += string[a]

       a += 1

print("Original String:", string)

print("Capitalized words String", string2)

Read more on Brainly.in - https://brainly.in/question/9752907#readmore

Similar questions