3
def digital_root(n):
    s=0
    if  n < 10:
        return n
    else:
        while n>0:
            s+=n%10
            n=n//10
        digital_root(s)

I am having trouble submitting this question.

I made sure to return the digit and i checked that the digit was correct by outputting it to the logs, but the tests keep failing and saying that I am returning None. I am not.

thewires2
  • 35
  • 5

1 Answers1

2

You need a return before the recursive call:

def digital_root(n):
    s=0
    if  n < 10:
        return n
    else:
        while n>0:
            s+=n%10
            n=n//10
        return digital_root(s)        # added 'return' here
Aziz Sonawalla
  • 2,482
  • 1
  • 5
  • 6