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

 

countuptoneg


Given a list of integers, return the number of integers before the first negative one. If there is no negative integer in the entire list, this should simply return the length of the list. Use this to practise with the "break" statement.


countuptoneg([1, 2, 3, -4, 5, -6]) → 3
countuptoneg([-1, 2, 3, 4, 5, 6]) → 0
countuptoneg([1, 0, 2, 3, -4, 5]) → 4

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

def countuptoneg(list):

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