Skip to content

TypeScript code snippet – How to find a combination of all elements in a python list?

import itertools

stuff = [1, 2, 3]
for L in range(0, len(stuff)+1):
    for subset in itertools.combinations(stuff, L):
        print(subset)
See also  Python code snippet - How to place a plot in a tkinter frame?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.