Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions

Question

8.6 Discusstwo techniques used for assessing training needs.

Answered: 1 week ago