I have been searching all over the internet and I can't seem to find how to answer my homework question. The user should enter matrices and indicate whether the matrices are to be added or subtracted. You should be able to add or subtract as many matrices as you wish without having to re-enter the previous solution. I am a beginner with python and am not sure how to go about this. All I have so far is
#Ask the user to input a matrix
print ('Enter your row one by one (pressing enter between each row).
To terminate, enter an empty row.')
M = []
#Allow them to determine dimensions
while True:
r = input ('Next row > ')
if not r.strip (): # Empty input
break
M.append(list(map(int, r.split())))
#Display the matrix
print('M =', M)