I have a list of variables, the number of which can change. Each variable has a lower limit, upper limit and an increment value. For example:
variables = {
"a": [1, 10, 1],
"b": [50, 200, 5],
"c": [50, 300, 10]
}
Where for key "a", 1 is the lower limit, 10 is the upper limit and 1 is the increment amount.
"a" would go from 1 through 10, incrementing by 1
"b" would go from 50 through 200, incrementing by 5
"c" would go from 50 through 300, incrementing by 10
... there can be more or less such keys.
I need to create a list of all possible combinations of a, b and c, without hard coding nested loops, as there are an unknown number of variables/keys, and just cannot wrap my head around it. I'm using Python 3.7
The output would ideally be a table of combinations of each variable, perhaps comma separated values. For example.
a b c
x y z
x y z
x y z
x y z
However, anything will do, as long as I can collate the output into a format where each combination can be accessed as a set. Such as a list of tuples.
[
(x, y, z)
(x, y, z)
]
...