Hey guys I have three lists:
a={{1, 2}, {1, 3}, {1, 2}, {1, 2}, {1, 2}}
b={{{2, 3}, {1, 3}}, {{2, 3}, {1, 3}}, {{2, 3}, {1, 3}}, {{2, 3}, {1,3}}, {{2, 3}, {1, 2, 3}}}
c={{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0, 0}}
What I'm trying to figure out is how do I do the following: I want to add a "T" into the front of every number in all the sublists for list "a". Then I want to do something similar with list "b" but this time I want to add an "A" into the front of every number in all the sublists giving me the following lists:
aa={{T1, T2}, {T1, T3}, {T1, T2}, {T1, T2}, {T1, T2}}
bb={{{A2, A3}, {A1, A3}}, {{A2, A3}, {A1, A3}}, {{A2, A3}, {A1, A3}}, {{A2, A3}, {A1, A3}}, {{A2, A3}, {A1, A2, A3}}}
Lastly what I want to do is I want to match certain elements in list "aa" to list "bb" and then insert those matched elements into list "c" giving me a new list "cc". For example, in the first sublist of list "aa" there's a {T1,T2}
that corresponds to the first sublist of {{A2,A3},{A1,A3}}.....}
in list "bb". What I want to do is then take T1
and pair it to the first sublist of the list given for "bb". So T1
would be distributed to A2
and A3
giving me elements of {T1,A2},{T1,A3}
. Then taking T2
I want to distribute it to A1
and A3
to give me elements {T2,A1}, {T2,A3}
.
That would overall give me elements {{T1,A2},{T1,A3},{T2,A1},{T2,A3}}
. I then want to take those elements and insert them into list "c". List "c" is just comprised of 0's which are just placeholders. So in the first sublist of list "c" we have {{0,0,0,0,0}....}.
I want to insert the elements above into list "c" to give me a new list "cc"
cc={{{T1,A2},{T1,A3},{T2,A1},{T2,A3}}...}}
I'm trying to find a way to do this process for all the sublists in "aa" and "bb" and input them all into "c" to give me a new list "cc".
In lists "aa" and "bb" each sublist correspond to one another. So in list "aa", the first sublist of {T1,T2}
relates to the first sublist in list "bb" of {{{A2, A3}, {A1, A3}}...
. The second sublist correspond together, e.g. in "aa" the second sublist {T1, T3}
corresponds to the second sublist of {...{{A2, A3}, {A1, A3}}...} in list "bb", So on and so forth.