Answers for "python get list combinations"

6

get all combinations from two lists python

a = ["foo", "melon"]
b = [True, False]
c = list(itertools.product(a, b))
>> [("foo", True), ("foo", False), ("melon", True), ("melon", False)]
Posted by: Guest on April-21-2020
3

python permutation

import itertools

a = [1, 2, 3]
n = 3

perm_iterator = itertools.permutations(a, n)

for item in perm_iterator:
    print(item)
Posted by: Guest on October-30-2020
1

python get all combinations of list

itertools.combinations(iterable, r)
Posted by: Guest on January-29-2021

Code answers related to "python get list combinations"

Python Answers by Framework

Browse Popular Code Answers by Language