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

 

spragunr@jmu.edu > convert
prev  |  next  |  chance

Return a list where all values greater than the provided threshold are at the end, and all other values are converted to zeros. The relative order of the non-zero values should not be changed.


convert([5, 4, 3, 2, 1], 3) → [0, 0, 0, 5, 4]
convert([5, 4, 3, 2], 0) → [5, 4, 3, 2]
convert([20, 1, 19, 3, 22, 4], 15) → [0, 0, 0, 20, 19, 22]

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

def convert(nums, threshold):

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