def digit_sum(number):
sumOfDigits = 0
while number > 0:
sumOfDigits += number % 10
number = number // 10
return sumOfDigits
or you can use,
In [2]: digit_sum(10)
Out[2]: 1
In [3]: digit_sum(434)
Out[3]: 11
or you can use,
digits = "12345678901234567890"
digit_sum = sum(map(int, digits))
print("The equation is: ", '+'.join(digits))
print("The sum is:", digit_sum)
Have a great day <3