Function named intersperse

by | Oct 3, 2021 | Assignment

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 stringExample:>>> 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

Plagiarism-free and delivered on time!

We are passionate about delivering quality essays.

Our writers know how to write on any topic and subject area while meeting all of your specific requirements.

Unlike most other services, we will do a free revision if you need us to make corrections even after delivery.