I'm getting an infinite loop when I try to solve this problem using 'while' and incorporating the modulo + floor divide method. I can do it using 'for' (see code below), but using very similar code doesn't work with while. It's telling me I get an infinite loop - why is this the case when I have included "num = int(num) // 10", which should take off the last digit and decrease len(num) by 1?

```
# code works with 'for'
def digit_sum(n):
count = 0
num = str(n)
for i in range(len(num)):
count += (n % 10)
n = n // 10
return count
# similar code does not work with 'while'
def digit_sum(n):
count = 0
num = str(n)
while len(num) > 0:
count += (int(num) % 10)
num = int(num) // 10
num = str(num)
return count
```