Hi all,

First time poster here and very new to python, so sorry if something doesn't make sense!

I'm trying to figure out how to get the sum of a list of numbers.

I've figured out how to do it with just one input as below:

```
x = 1234
def digit_sum(n):
sum_n = 0
while n>0:
sum_n += (n%10)
n=n//10
return sum_n
```

e.g. 1234 = 1+2+3+4 = 10

But i can't figure out how to do it with a list, this is my script at the moment:

```
y = [1234, 5678, 3456]
def digit_test(n):
sum_n = []
for i in n:
while i>0:
sum_n += (i%10)
i = i//10
return sum_n
print digit_test(y)
```

I would like the above to equal [10, 26, 18]

It just returns this error:

Traceback (most recent call last):

File "python", line 35, in

File "python", line 31, in digit_test

TypeError: 'int' object is not iterable.

It's the while loop i've got a problem with, i'm able to apply a function to each element in the list when a while loop isn't needed, but for this i do.

Does anyone have any idea?

Thanks,

TJ