id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

rnewton31@gatech.edu ds-attendance > interleave
prev  |  next  |  chance

Given two lists, list1 and list2, output a new list created by interleaving the items in list1 and list2. In other words, create an output list that looks like:

output = [list1[0], list2[0], list1[1], list2[1], ..., list1[n], list2[n]]
Both lists will always have the same length.

interleave([1, 2, 3], [4, 5, 6]) → [1, 4, 2, 5, 3, 6]
interleave([5, 9], [2, 1]) → [5, 2, 9, 1]
interleave([4, 5, 1], [0, 2, 3]) → [4, 0, 5, 2, 1, 3]

...Save, Compile, Run (ctrl-enter)

def interleave(list1, list2):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 240

Copyright Nick Parlante 2017 - privacy