def rowswap(matlist, index1, index2, K):
 (matlist[index1], matlist[index2]) = (matlist[index2], matlist[index1])
 return matlist

def rowswap ( matlist , index1 , index2 , K ) : ( matlist [ index1 ] , matlist [ index2 ] ) = ( matlist [ index2 ] , matlist [ index1 ] ) return matlist
returns the matrix with index1 row and index2 row swapped .