I have a complete matching in the form:
M=[(1,3),(2,4),(5,6)]
I want to perform a simple transposition on it.
Function si(M)
should swap the positions of numbers i
and i+1
.
For instance s2(M)
should swap the positions of numbers 2
and 3
:
s2(M)
should return:
[(1,2),(3,4),(5,6)]
Preferably written in python3 code.