Skip to content

Instantly share code, notes, and snippets.

@bgnori
Created July 7, 2017 04:38
Show Gist options
  • Save bgnori/141b5fd0c2b7ee5374c76ab2c378f437 to your computer and use it in GitHub Desktop.
Save bgnori/141b5fd0c2b7ee5374c76ab2c378f437 to your computer and use it in GitHub Desktop.
# coding: utf-8
import itertools
def baz(xs, n):
ys = list(itertools.zip_longest(xs[n::4], xs[n+1::4], fillvalue=' '))
zs = itertools.zip_longest(ys[0::4], ys[1::4], ys[2::4], ys[3::4], fillvalue=(' ', ' '))
return [[p for ps in z for p in ps] for z in zs]
xs = [chr(i) for i in range(ord('a'), ord('z')+1)]
for s in [" ".join(line) for lines in zip(baz(xs, 0), baz(xs, 2)) for line in lines]:
print(s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment