I am writing a function to make a 'digital root', which adds all digits of a number together recursively until it is one digit.
When I ask the function to return a value, it returns 'None', but if I ask it to print the value, it returns the correct answer.
Code:
def digital_root(n):
if len(str(n)) != 1:
list = []
for i in str(n):
list.append(int(i))
n = sum(list)
digital_root(n)
else:
return n