Hello everyone, need some help with my code:

```
import math
n=int(raw_input("enter the number: "))
a=[]
print digit_sum(n)
def digit_sum(n):
k=len(str(n))
print "length is ",k
for i in range(0,k):
m=n/(10**(k-1))
m=math.floor(m)
a.append(m)
num=n%(k-1)
n=num
k-=1
return sum(a)
```

and error is:

Traceback (most recent call last):

File "python", line 4, in

File "python", line 13, in digit_sum

ZeroDivisionError: integer division or modulo by zero