Interleave items from each of the given iterables
I want you to write a function that accepts two lists and returns a new iterable with each of the given items "interleaved" (item 0 from iterable 1, then item 0 from iterable 2, then item 1 from iterable 1, and so on).
Here's an example (which returns lists):
>>> interleave([1, 2, 3, 4], [5, 6, 7, 8])
[1, 5, 2, 6, 3, 7, 4, 8]
I want you to assume that the lists have the same length. Don't worry at all about what to do with different length lists. We'll actually handle that in a future exercise.
See if you can figure out at least one of the bonuses for this exercise if you have time.
Bonus 1
This is just a preview of the problem statement.
This exercise includes 2 bonuses and 5 hint links.
To solve this exercise, sign in to your Python Morsels account.
My name is Trey Hunner and I hold Python trainings for teams. I've spent countless hours refining my most interesting Python exercises into Python Morsels, a Python skill-building platform for folks who already know Python. Python Morsels is design to help you deepen your Python skills every week.
Sign up for Python Morsels to access this exercise and many more.
Join Python Morsels ✨