def somadig(n):
if n == 0:
return 0
else:
return (n % 10) + somadig(n // 10)
print(somadig(120))
#https://pt.stackoverflow.com/q/349093/101
ZGVmIHNvbWFkaWcobik6CiAgICBpZiBuID09IDA6CiAgICAgICAgcmV0dXJuIDAKICAgIGVsc2U6CiAgICAgICAgcmV0dXJuIChuICUgMTApICsgc29tYWRpZyhuIC8vIDEwKQoKcHJpbnQoc29tYWRpZygxMjApKQoKI2h0dHBzOi8vcHQuc3RhY2tvdmVyZmxvdy5jb20vcS8zNDkwOTMvMTAx