def digit_sum(n): \'\'\'(int)->number Returns the sum of all the digits in the given integer, n\'\'\' if n<10: return n return n%10 + digit
So the idea is that you have to use recursion for the last one as well? In that case, this should do the job:
def digital_root(n): if n < 10: return n return digital_root(digit_sum(n))