forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice ocpython > recursiveDigitSum
prev  |  next  |  chance

recursiveDigitSum() -- Given a non-negative integer n, write a recursive function that returns the sum of the digits of n. NOTE: You may not use any loops (for or while), nor may you convert n to a String. You'll probably want to use the % and / operators.

recursiveDigitSum(111) → 3
recursiveDigitSum(123) → 6
recursiveDigitSum(908841) → 30

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

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