most efficient method to find sum of digits of a number in 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