Answer to Question #255518 in Python for baby

Question #255518

import numpy as np

def matrix(m,n):

list1 = []

list2 = []

for i in range(m*n):

inputs = int(input('Enter numbers on intended matrix here: '))

list1.append(inputs)

for i in range(m*n):

order_input = min(list1)

list1.remove(order_input)

list2.append(order_input)

matrix1 = np.array(list2)

matrix2 = matrix1.reshape(m,n)

print(matrix2)

matrix(2,3)




1
Expert's answer
2021-10-23T08:06:11-0400
import numpy as np


def matrix(m,n):


    list1 = []


    list2 = []


    for i in range(m*n):


        inputs = int(input('Enter numbers on intended matrix here: '))


        list1.append(inputs)


    for i in range(m*n):


        order_input = min(list1)


        list1.remove(order_input)


        list2.append(order_input)


    matrix1 = np.array(list2)


    matrix2 = matrix1.reshape(m,n)


    print(matrix2)


matrix(2,3)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS