id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

rnewton31@gatech.edu > reorder_list
prev  |  next  |  chance

Given a list of data points, data, and a list of indices into data, order, return a new list containing all the numbers in data, ordered by the indices in order.

For example, if data = [1, 2, 3] and order = [2, 1, 0], the first item in order is 2, meaning the first number in the output will be data[2], which is 3. The second item in the output will be data[1] = 2, with the final item being data[0] = 1.


reorder_list([1, 2, 3], [0, 2, 1]) → [1, 3, 2]
reorder_list([1, 2, 3], [0, 1, 2]) → [1, 2, 3]
reorder_list([1, 2, 3], [2, 1, 0]) → [3, 2, 1]

...Save, Compile, Run (ctrl-enter)

def reorder_list(data, order):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 180

Copyright Nick Parlante 2017 - privacy