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

 

bryce.hulett@hotmail.com > min_to_front
prev  |  next  |  chance

Write a function min_to_front that takes a list of integers as a parameter and that moves the minimum value in the list to the front, otherwise preserving the order of the elements. For example, if a variable called list stores the following values: [3, 8, 92, 4, 2, 17, 9] and you make the call of min_to_front(list) it should store the following values after the call: [2, 3, 8, 92, 4, 17, 9] You may assume that the list stores at least one value.


min_to_front([3, 8, 92, 4, 2, 17, 9]) → [2, 3, 8, 92, 4, 17, 9]
min_to_front([6, 1, 4, -2]) → [-2, 6, 1, 4]
min_to_front([50, 10, 30, 40, 20]) → [10, 50, 30, 40, 20]

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

def min_to_front(lst):

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: 290 Post-solution available

Copyright Nick Parlante 2017 - privacy