number = 123 # the number you want summed up sum_of_digits = 0 for digit in str(number): sum_of_digits += int(digit) print(sum_of_digits) # printing the final sum of number