Question: Python: Based on my code for transposing a matrix, why am I getting this error message? This matrix formatting is coming from the following function:

Python: Based on my code for transposing a matrix, Python: Based on my code for transposing a matrix, why am I why am I getting this error message? getting this error message? This matrix formatting is coming from the following This matrix formatting is coming from the following function: function: 45 46 D 47 48 49 def transposed(m): # Return a

45 46 D 47 48 49 def transposed(m): # Return a new matrix where m's # rows become the columns and # the columns become the rows. # Return a brand new matrix. Use append. new_matrix = [] for row in range(Len(m[0])): for col in range(Len(m)): new_matrix.append(m[col][row]) return new_matrix 50 51 D 52 53 54 A File "C:\Users\alber\pycharmProjects CSC250\matrix.py", line 16, in show print('{:4d}'.format(m[row][col]), end="") TypeError: 'int' object is not subscriptable 9 DD 10 11 def show(m): for row in range(0, 4): for col in range(0, 5): print('{:4d}'.format(m[row][col]), end=""') print() 12 13

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!