I'm currently working on the K2 Algorithm, where it is necessary to find out all combinations of states and values of the current variable and its possible parents.

e.g. X1, X2 and X3 (current variable) is given. X1 can have the value {0, 1, 2, 3}, X2 {0, 1} and X3 {0, 1, 2, 3, 4}.

so basically you can create a list with the possible max values: `[3, 1, 4]`

Now where I'm stuck is to create a function that returns all possible combinations:

```
[0, 0, 0]
[0, 0, 1]
[0, 0, 2]
[0, 0, 3]
[0, 1, 0]
[0, 1, 1]
[0, 2, 0]
...

```

The max values and the length of the list should be flexible.

Thank you so much for your help!!