Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Inserting elements in a list

I would like to transform a list, for example:

A = [((1, 1), (1, 1, 1, 1)),
     ((1, 1), (1, 1, 1, 1)),
     ((1, 1), (1, 1, 1, 2)),
     ((1, 1), (1, 1, 1, 3)),
     ((1, 1), (1, 1, 2, 1)),
     ((1, 1), (1, 1, 3, 1)),
     ((1, 1), (1, 2, 1, 1)),
     ((1, 1), (1, 2, 1, 2)),
     ((1, 1), (1, 2, 1, 3)),
     ((1, 1), (1, 3, 1, 1)),
     ((1, 1), (1, 3, 1, 2)),
     ((1, 1), (1, 3, 1, 3))]

into

A = [((1, 1, 0), (1, 1, 1, 1)),
     ((1, 1, 0), (1, 1, 1, 1)),
     ((1, 1, 0), (1, 1, 1, 2)),
     ((1, 1, 1), (1, 1, 1, 3)),
     ((1, 1, 1), (1, 1, 2, 1)),
     ((1, 1, 1), (1, 1, 3, 1)),
     ((1, 1, 2), (1, 2, 1, 1)),
     ((1, 1, 2), (1, 2, 1, 2)),
     ((1, 1, 2), (1, 2, 1, 3)),
     ((1, 1, 3), (1, 3, 1, 1)),
     ((1, 1, 3), (1, 3, 1, 2))]

Any suggestions?

Inserting elements in a list

I would like to transform a list, for example:

A = [((1, 1), (1, 1, 1, 1)),
     ((1, 1), (1, 1, 1, 1)),
     ((1, 1), (1, 1, 1, 2)),
     ((1, 1), (1, 1, 1, 3)),
     ((1, 1), (1, 1, 2, 1)),
     ((1, 1), (1, 1, 3, 1)),
     ((1, 1), (1, 2, 1, 1)),
     ((1, 1), (1, 2, 1, 2)),
     ((1, 1), (1, 2, 1, 3)),
     ((1, 1), (1, 3, 1, 1)),
     ((1, 1), (1, 3, 1, 2)),
     ((1, 1), (1, 3, 1, 3))]
2))]

into

A = [((1, 1, 0), (1, 1, 1, 1)),
     ((1, 1, 0), (1, 1, 1, 1)),
     ((1, 1, 0), (1, 1, 1, 2)),
     ((1, 1, 1), (1, 1, 1, 3)),
     ((1, 1, 1), (1, 1, 2, 1)),
     ((1, 1, 1), (1, 1, 3, 1)),
     ((1, 1, 2), (1, 2, 1, 1)),
     ((1, 1, 2), (1, 2, 1, 2)),
     ((1, 1, 2), (1, 2, 1, 3)),
     ((1, 1, 3), (1, 3, 1, 1)),
     ((1, 1, 3), (1, 3, 1, 2))]

Any suggestions? suggestions?

Inserting elements in a list

I would like to transform a list, for example:

A = [((1, 1), (1, 1, 1, 1)),
     ((1, 1), (1, 1, 1, 1)),
     ((1, 1), (1, 1, 1, 2)),
     ((1, 1), (1, 1, 1, 3)),
     ((1, 1), (1, 1, 2, 1)),
     ((1, 1), (1, 1, 3, 1)),
     ((1, 1), (1, 2, 1, 1)),
     ((1, 1), (1, 2, 1, 2)),
     ((1, 1), (1, 2, 1, 3)),
     ((1, 1), (1, 3, 1, 1)),
     ((1, 1), (1, 3, 1, 2))]

into

A = [((1, 1, 0), (1, 1, 1, 1)),
     ((1, 1, 0), (1, 1, 1, 1)),
     ((1, 1, 0), (1, 1, 1, 2)),
     ((1, 1, 1), (1, 1, 1, 3)),
     ((1, 1, 1), (1, 1, 2, 1)),
     ((1, 1, 1), (1, 1, 3, 1)),
     ((1, 1, 2), (1, 2, 1, 1)),
     ((1, 1, 2), (1, 2, 1, 2)),
     ((1, 1, 2), (1, 2, 1, 3)),
     ((1, 1, 3), (1, 3, 1, 1)),
     ((1, 1, 3), (1, 3, 1, 2))]

Any suggestions?