Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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 functionsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started