I need to create a recursive function that receives a number n
integer and returns the sum of the digits of this number.
I made the following code but it is giving None
:
def somadig(n, s = 0):
if n > 10:
d = n%10
s += d
return somadig(n//10,s)
print(somadig(120))