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

 

david.white@denison.edu cs112fall2015 > sum
prev  |  next  |  chance

Write a recursive function which takes the sum of the first n numbers. Your function MUST be recursive. Do not use a loop. You may assume n is positive.


sum(2) → 3
sum(4) → 10
sum(5) → 15

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

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

Copyright Nick Parlante 2017 - privacy