Skip to content

Instantly share code, notes, and snippets.

@yuheiomori
Created May 3, 2012 00:00
Show Gist options
  • Save yuheiomori/2582040 to your computer and use it in GitHub Desktop.
Save yuheiomori/2582040 to your computer and use it in GitHub Desktop.
CodeEval Multiplication Tables
from itertools import product, groupby
for k, g in groupby(product(range(1, 13), repeat=2), lambda x: x[0]):
print ''.join([str(i * j).rjust(4) for i, j in g]).strip()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment