Row Example of Python Implementation Switch Matrix


As shown below:

# TODO r1 <---> r2
#  Modify the parameter matrix directly, and there is no return value
def swapRows(M, r1, r2):
  M[r1],M[r2] = M[r2],M[r1]
  pass