def Matrix(r,c,s):
a = 1
Matrix = []
print("Enter Matrix %s: "%(s))
for p in range(r):
try:
while (a):
row = [int(i) for i in input().split()]
if len(row)==c:
Matrix.append(row)
break
except ValueError:
print("Error")
continue
return Matrix
rows,columns=map(int,input("Enter the dimensions:").split(","))
A = Matrix(rows,columns,"A")
B = Matrix(rows,columns,"B")
Then how do we show these code in a flowchart??
def Matrix(r,c,s):
a = 1
Matrix = []
print("Enter Matrix %s: "%(s))
for p in range(r):
try:
while (a):
row = [int(i) for i in input().split()]
if len(row)==c:
Matrix.append(row)
break
except ValueError:
print("Error")
continue
return Matrix
rows,columns=map(int,input("Enter the dimensions:").split(","))
A = Matrix(rows,columns,"A")
B = Matrix(rows,columns,"B")
Comments
Leave a comment