Jun-11-2018, 08:25 PM
You need to transform each row first to integer, either when you read the values:
for i in range(r): row = input("Row values:") m.append([int(s) for s in row.split()])Or later:
m = [[int(s) for s in row] for row in m]Remember that numpy only transforms a matrix given as a list of lists to a 2D array if all the lists have the same number of elements, so you might want to use the c value that you are not using to guarantee that the user inputs the right number of elements (or to add 0 or truncate as needed)