Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

combinations python

from itertools import combinations

school_subjects = ["math", "science", "history", "geography", "language arts", "Spanish"]

num_per_combos = 3

combos = list(combinations(school_subjects, num_per_combos))

for lists in combos:
    for combo in lists:
        print(combo + " ")
    print("
")
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #combinations #python
ADD COMMENT
Topic
Name
4+8 =