Question: How can i solve this question by using Python? I removed the row correctly but I guess for columns, the for loop keeps repeating and

 How can i solve this question by using Python? I removedthe row correctly but I guess for columns, the for loop keeps

How can i solve this question by using Python? I removed the row correctly but I guess for columns, the for loop keeps repeating and I don't know how to stop it.

Both functions take a rectangular list Ist and two ints, row and col. They then both create a version of the list that has the given row and given column removed. You may assume that row and col are both legal values (that is, they are non-negative integers that are smaller than the largest row and column, respectively). For example, the list shown to the left would lead to the result shown on the right when called with the row 1 and the column 2. lkst result 2, 3,4, 1 12,3,51 LB, 7, 6,5], t e, 1, 2, 31 Le, 1, 3 nondestructiveRemoveRowAndCol(lst, row, col): the non-destructive version should return a new list, and should not modify the provided list at all. def nondestructiveRemoveRowAndCol (lst, row, col): output lst + [ return lst if row > 0 output.pop (row) print("output",output) If col >0: for item in range(len (output)): output[item].pop (col) return output

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!