Computer Science, asked by vicky2247, 11 months ago

Write a function that takes a sentence as an input parameter where each word in the sentence is
separated by a space. The function should replace each blank with a hyphen and then return the
modified sentence.

Answers

Answered by tanushkharbanda385
0

Answer:

Write a function that takes a sentence as an input parameter where each word in the sentence is

separated by a space. The function should replace each blank with a hyphen and then return the

modified sentence.

Explanation:

Answered by bLaziNgcoMbat
0

Answer:

Explanation:

def path( string ):

   newsen = ""

   for i in string :

       if i.isspace():

           newsen += "-"

       else :

           newsen += i

   return newsen

sen = input("Enter a Sentence :-")

print("New String :-", path(sen) )

Similar questions