Answers for "python all possible combinations of elements in the list"

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
4

how to get all possible combinations in python

all_combinations = [list(zip(each_permutation, list2)) for each_permutation in itertools.permutations(list1, len(list2))]
Posted by: Guest on April-06-2020

Code answers related to "python all possible combinations of elements in the list"

Python Answers by Framework

Browse Popular Code Answers by Language