Reading Time: 1 minutes
Sum of digits of a number in Python
Compute sum of digits of a number: Write a Python Program to calculate the sum of digits of a given number.
Compute sum of digits of a number
number = 432
summation = 0
for digit in str(number):
summation += int(digit)
print(summation) # 9







