https://www.codecademy.com/en/courses/python-intermediate-en-rCQKw/0/4?curriculum_id=4f89dab3d788890003000096

These codes was written by someone here in a previous topic

could someone describe their logic?

```
This is the first solution code:
def digit_sum(n):
soma = 0
while n >= 10:
soma+= n % 10
n = n//10
else:
soma+= n
return soma
This is the other one:
def digit_sum(n):
number_of_digits = len(str(n))
total = 0
i = 0
while i < number_of_digits:
total = total + (n % 10)
n = n // 10
i += 1
return total
Add your code here, between the ```'s!
```