Let us suppose I have 3 lists with each of them has random numbers ranging from (0-9)
digit_0 = [0, 1, 2, 3, 5, 8]
digit_1 = [1, 2, 3, 8, 9]
digit_2 = [3, 4, 6, 7]
I want to create all the possible numbers for 3 -digit number ABC
, such that A
can only take values from digit_0
, B
can only from digit_1
and C
can only from digit_2
arrays
The simplest solution seems to be creating 3 loops
for A in digit_0:
for B in digit_1:
for C in digit_2:
However, I am wondering is there a more effective solution ?