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

 

sumn


Given an int n, return the sum of the integers 1 to n (1 + 2 + 3 + ... + n). If n is 0, return 0.


sumn(3) → 6
sumn(5) → 15
sumn(9) → 45

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

def sumn(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

Post-solution available

Copyright Nick Parlante 2017 - privacy