print ("The scope of this program is to multiply two matrices together\
and print the result")
while True:
matrix1_rows = input("How many rows does matrix one have? ")
matrix1_columns = input("How many columns does matrix one have? ")
print ("Matrix one is a", matrix1_rows, "x", matrix1_columns, "matrix")
print()
matrix2_rows = input("How many rows does matrix two have? ")
matrix2_columns = input("How many columns does matrix one have? ")
print ("Matrix two is a", matrix2_rows, "x", matrix2_columns, "matrix")
if(matrix1_columns != matrix2_rows):
print("\nSorry, cannot multiply these two matrices, must be (mxn)*(nxp)")
else:
break
print("----------------------------------------------------------")
print("\nThe system will now take values for matrix one, one row at a time")
print("Enter the values of the first row, click enter then the second row, and so on")
for i in range (0, int(matrix1_rows)):
if (i == 0):
matrix1_row1_set = input("Please enter the values for the row\n")
I want to be able to have the user enter the number of rows that the matrix has and then ask for each rows value (Like user entering "1 0 5 9 5") and assigning that to the variable matrix1_row1_set then getting another row and assigning it to a variable like matrix1_row2_set
What would be the most efficient way to do this?