add up digits of a number python code example
Example: python sum of digits
def sum_digits(n):
s = 0
while n:
s += n % 10
n //= 10
return s
def sum_digits(n):
s = 0
while n:
s += n % 10
n //= 10
return s