Ordered Matrix in Python

Problem Statement:

In the ordered matrix in python, we are given a matrix of integers. We need to convert the given matrix to an ordered matrix and print it. An ordered matrix is a matrix that is sorted row-wise.

Code for Ordered Matrix in Python:

matrix = [[3432, 112, 5665],
          [223, 12, 45],
          [988, 4353, 2]]

myList = []

for i in range(len(matrix)):
    for j in range(len(matrix[i])):


for i in range(len(matrix)):
    for j in range(len(matrix[i])):
        matrix[i][j] = myList[k]
        k += 1
import numpy as np
matrix = np.array(matrix)



Output for ordered matrix in python

Also Read:


Author: Harry

Hello friends, thanks for visiting my website. I am a Python programmer. I, with some other members, write blogs on this website based on Python and Programming. We are still in the growing phase that's why the website design is not so good and there are many other things that need to be corrected in this website but I hope all these things will happen someday. But, till then we will not stop ourselves from uploading more amazing articles. If you want to join us or have any queries, you can mail me at admin@copyassignment.com Thank you