Question: Write the function duplicate_col(L, index, n) that takes in a 2D list L, a column index, and a number, and destructively modifies L so

Write the function duplicate_col(L, index, n) that takes in a 2D list L, a column index, and a number, and 

Write the function duplicate_col(L, index, n) that takes in a 2D list L, a column index, and a number, and destructively modifies L so that the specified column at index iis duplicated n times. L is [[1,2,3]. [4,5,6], [7,8,9]], i is 0, and n is 2. Then the list should become [[1,1,1,2,3]. [4,4,4,5,6], [7,7,7,8,9]].Since this is a destructive function, avoid any operations that make copies of lists (like slicing or the plus operator). Instead use appropriate destructive list method(s). Additionally, it should not return anything since it's a destructive function.

Step by Step Solution

3.45 Rating (152 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

def du... View full answer

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 Programming Questions!