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

 

dsawyer@methacton.org > bePositive
prev  |  next  |  chance

Complete the function so that it returns a list that is identical to the parameter list except that all the negative numbers and zeros have been removed. The remaining positive values should keep their same relative positions.


bePositive([9, -2, 10, 1, 0]) → [9, 10, 1]
bePositive([-5, -12, 6]) → [6]
bePositive([99, 413, 100]) → [99, 413, 100]

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

def bePositive( nums ):

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

Copyright Nick Parlante 2017 - privacy