prof-rossetti/nyu-info-2335-201905

Combinations and Permutations

Closed this issue · 0 comments

s2t2 commented
from itertools import combinations 

vals = ["M", "C", "P", "Z"]
combos = combinations(vals, 2) # choose 2
list(combos) #> [('M', 'C'), ('M', 'P'), ('M', 'Z'), ('C', 'P'), ('C', 'Z'), ('P', 'Z')]

h/t: https://www.geeksforgeeks.org/permutation-and-combination-in-python/