I have these two lists, mylist = {{a,b},{c,d}}
, and mysecondlist = {1,2}
I want to generate this output: output = {{{a,b,1},{a,b,2}},{{c,d,1},{c,d,2}}}
In other words, output[[1,1,1]] = {mylist[[1,1]],mysecondlist[[1]]}
, output[[1,1,2]] = {mylist[[1,1]],mysecondlist[[2]]}
, and so on. The original 2D list becomes a 3D one.
I'm not actually sure what the name of the operation is, let alone which command to use in Mathematica. Is there a command that generates this, or do I have to do it with a Do loop that runs over all the possible indices and defines them one by one?