Skip to content

Instantly share code, notes, and snippets.

@graup
Created April 13, 2017 04:56
Show Gist options
  • Select an option

  • Save graup/c3b0c5eef4105d8283297bcb47f23d64 to your computer and use it in GitHub Desktop.

Select an option

Save graup/c3b0c5eef4105d8283297bcb47f23d64 to your computer and use it in GitHub Desktop.

Revisions

  1. graup created this gist Apr 13, 2017.
    7 changes: 7 additions & 0 deletions permutations.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    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]))