jeudi 4 juin 2020

Return statement is not working in python inside if condition

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.

Aucun commentaire:

Enregistrer un commentaire