Oops, try again. Did you create a function called digit_sum? Your code threw a "local variable 'sum' referenced before assignment" error.

It should return the sum of digits ,i guess .

```
def digit_sum(n):
while n>0:
for digits in range(len(str(n))):
sum+=int(str(n)[digits])
return sum
```