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
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
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
Math,
5 months ago
Math,
5 months ago
Computer Science,
11 months ago
Computer Science,
1 year ago
Computer Science,
1 year ago
Math,
1 year ago