Skip to content

Instantly share code, notes, and snippets.

@graup
Created April 13, 2017 04:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save graup/c3b0c5eef4105d8283297bcb47f23d64 to your computer and use it in GitHub Desktop.
Save graup/c3b0c5eef4105d8283297bcb47f23d64 to your computer and use it in GitHub Desktop.
from itertools import permutations
# Generate permutations
p = list(permutations('1234', 4))
# Flip table for display in columns
flipped = [[p[j][i] for j in range(4*3*2)] for i in range(4)]
# Print table
print("\n".join([" ".join(row) for row in flipped]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment