Skip to content

Instantly share code, notes, and snippets.

@atondwal
Created December 30, 2013 09:32
Show Gist options
  • Save atondwal/8179820 to your computer and use it in GitHub Desktop.
Save atondwal/8179820 to your computer and use it in GitHub Desktop.
def shuffle(first, second):
if first is "" and second is "" : yield ""
if first is not "":
for i in shuffle(first[:-1],second): yield (i+first[-1])
if second is not "":
for i in shuffle(first,second[:-1]): yield (i+second[-1])
[print(i) for i in shuffle("12","34")]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment