Skip to content

Instantly share code, notes, and snippets.

@toniesteves
Created June 15, 2020 05:36
Show Gist options
  • Save toniesteves/2c134f64854df41826d1be0120f2ea1f to your computer and use it in GitHub Desktop.
Save toniesteves/2c134f64854df41826d1be0120f2ea1f to your computer and use it in GitHub Desktop.
from itertools import chain, combinations
authors = ['Andrew Ng', 'François Chollet', 'Josh Stamer', 'Kent Beck', 'Erick Evans', 'Soumith Chintala'];
def subsets(iterable):
s = list(iterable)
return chain.from_iterable(combinations(s, r) for r in range(len(s)+1))
print(list(subsets(authors)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment