Question: IN PYTHON Write two functions (1) flattenlist that allows a user to flatten a 2D list into a ID list and (2) unflatten( that unflattens

IN PYTHON

IN PYTHON Write two functions (1) flattenlist that allows a user to

Write two functions (1) flattenlist that allows a user to flatten a 2D list into a ID list and (2) unflatten( that unflattens a 1D list into a 2D list. For example, (1) Case 1: if the 2D list contains the following values: 1 2 4 5 7 8 3 6 9 Then flattening it produces the following 1D list: 1 2 3 4 5 6 7 8 9 The user chooses the dimensions of the 2D but you should determine the length of the resulting 1D list. (2) Case 2: if list contains the following values: 10 20 30 40 50 60 70 80 90 Then unflattening it into a 3x3 2D list produces the following list: 10 20 30 40 50 60 70 80 90 The user chooses the length of the ID list and the dimensions of the 2D list in this case. You are NOT allowed to use built-in functions that flatten or unflatten your lists. Write a program that tests both functions

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!