Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python programming Screenshot plz . Part IV: Untangling a List (20 points) Write a function untangle 0 that takes the following arguments, in this order:

image text in transcribed

Python programming Screenshot plz

. Part IV: Untangling a List (20 points) Write a function untangle 0 that takes the following arguments, in this order: 1. numbers: a list of inte gers 2. len of sublist: a positive integer that is used to divide the list into several sub-lists; see below for more details. You may assume that the length of numbers is always a divisible by len.of sublist. The function splits the list of into a list of sub-lists. How this is done is most easily understood by example. Suppose the given list numbe rs is [5, 6, 7, 8, 9,10] and len of sublist is 2. This value oflen of.sublist indicates that each sub-list will have two items Now suppose we define the value k as ien (numbe rs) divided by len.ofsublist. The values from numbers at indexes 0, k, 2k will be placed in the first sub-list. CSE 101-Fall 2017 Homework #2 Page 3 . The values from numbers at indexes 1, k +1.2k +1,.. . will be placed in the second sub-list. . The values from numbers at indexes 2, k +2.2k2... will be placed in the third sub-list and so on. Returning to our example with numbers 15, 6, 7, 8,9,10] and len of.aublist- 2 1. The first inte ger (5) goes into the first sub-list 2. The second inleger (6) goes into the second sub-list 3. The third integer (7) goes into the third sub-list. 4. The fourth integer (8) goes into the second position of the first sub-list. 5. The fifth integer (9) goes into the second position of the second sub-list 6. The sixth integer (10) goes into the second position of the third sub-list. The returned list of lists will be: I15, 8, 6,9, 17,1011 Examples Return Value Function Call untangle(ll.2,3, 4,5, 6 2) untangle (E, 4, 7,2,5, 8,3,6,91, 3) 2,3, 14,5,61, 17.8,91 untangle (11,2,3, 1) L[11, 12], 13] Remember: Codeload has additional tests for you to try! Upload your code there and see how your code matches up against harder tests

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_2

Step: 3

blur-text-image_3

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

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

More Books

Students also viewed these Databases questions

Question

Differentiate 3sin(9x+2x)

Answered: 1 week ago

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago