I was having trouble with this excercise and checked out the hint for a guide. It suggests to turn the digit into a string, itirate over the characters of the now converted string and add the substrings. Finishing with the reconvertion into and integer.
I resolved it this way
total = 0
for x in str(n):
total += int(x)
It works perfectly, but I don’t understand the point of going through the convertion and reconvertion. Isn’t there a way to add the digits of a number without turning them into a string?