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

 

amgreyson@gmail.com > binaryListSort
prev  |  next  |  chance

Given a list containing only zeros and ones, write an iterative (non-recursive) solution to return a list containing the same values with all the zeros appearing first in the list. Do not use the built-in Python sorted() function.


binaryListSort([0, 1, 1, 1, 1, 0, 0, 0, 1, 0]) → [0, 0, 0, 0, 0, 1, 1, 1, 1, 1]
binaryListSort([0]) → [0]
binaryListSort([]) → []

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

def binaryListSort( aBinaryList ):

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: 175

Copyright Nick Parlante 2017 - privacy