Skip to content

Instantly share code, notes, and snippets.

@milesrout
Last active March 31, 2017 06:57
Show Gist options
  • Save milesrout/b0c344b3ab68873d3f8c9ce19f4579f4 to your computer and use it in GitHub Desktop.
Save milesrout/b0c344b3ab68873d3f8c9ce19f4579f4 to your computer and use it in GitHub Desktop.
def intersperse(z, d):
q = [x for y in z for x in [y, y]]
q[1::2] = [d for x in z]
return q[:-1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment