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.
-
First, input two strings and split them to make lists.
-
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.
-
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']
-
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started