Question: Create a python code which implements a list weaving operation. First, input two strings and split them to make lists. Merge the lists into a

Create a python code which implements a list weaving operation.

  1. First, input two strings and split them to make lists.

  2. Merge the lists into a new list in the following way:

['a', 'b', 'c'] ['x', 'y', 'z'] should merge to ['a', 'x', 'b', 'y', 'c', 'z']

Merge in an alternating way, take from list 1 then list 2, list 1 again, then list 2 again, repeating this process until you have exhausted one of the lists.

  1. If there's anything left in one or the other lists, add it to the end of the list.

['a', 'b', 'c', 'd', 'e'] ['x', 'y', 'z'] merges to ['a', 'x', 'b', 'y', 'c', 'z', 'd', 'e']

  1. Ask for a separator and then output the list joined together by that separator.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!