Your function fails on digit_sum(1000). It returns 12 when it should return 1.

If I put the dig=[] upper on the def digit_sum, the course occurred alarm that "digit_sum(1000) result is 12 instead of 1" , but I ran this program on my local notepad+powershell, it ok , the result is right.

after that I put the dig=[] into the first line of function , then it worked normally .

I didn't get 2 points....

1:What's the difference between "dig=[]" inside/outside the function

2: if the "dig=[]" outside the function is wrong , why I can ran it successfully on my local....?

Thanks for guys to help me......

```
dig=[]
def digit_sum(n):
u=str(n)
for i in u:
dig.append(i)
s=0
for number in dig:
int(number)
s=s+int(number)
return s
```