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

 

david.white@denison.edu cs112fall2015 > swap_better
prev  |  next  |  chance

Write a function swap(data, i, j) that swaps the positions of the items with indices i and j in the list named data. Once you've created the list L with those entries swapped, finish the function by returning L.


swap_better([1, 2, 3, 4, 5], 1, 3) → [1, 4, 3, 2, 5]
swap_better([[1], 2, [3], 4, 5], 1, 1) → [[1], 2, [3], 4, 5]
swap_better(['yet', 'another', 'coding', 'bat', 'test'], 0, 4) → ['test', 'another', 'coding', 'bat', 'yet']

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

def swap_better(data,i,j):

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

Copyright Nick Parlante 2017 - privacy