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

 

konstans@stuy.edu all > sumFromZeroToN
prev  |  next  |  chance

Write a function that returns the sum of the values between 0 and the parameter n. When n is negative, return 0.


sumFromZeroToN(-3) → 0
sumFromZeroToN(4) → 10
sumFromZeroToN(10) → 55

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

def sumFromZeroToN(n):

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

Copyright Nick Parlante 2017 - privacy