Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

Construct a function named intersperse that will prompt the user to enter two sentences. Then it will print a combined sentence, consisting of...

Construct a function named intersperse that will prompt the user to enter two sentences. Then it will print a combined sentence, consisting of alternating words from each sentence: first from the first sentence, next from the second sentence, then the first sentence again, etc. If one sentence has more words than the other, the remaining words should be output at the end of the result. The function should take no parameters. Its signature should be () -> NoneType. For the purposes of this problem, you may consider a "word" to be any space-separated sequence of non-space characters, including punctuation. You may use the split method to separate a string into a list of its constituent words. You may use the join method to combine a list of words into a string

Example:

>>> intersperse()

Enter a sentence: It is an ancient mariner

Enter a sentence: Who stoppeth one of three

It Who is stoppeth an one ancient of mariner three

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question