Sum digits of numbers in a list
<p>Trying to write a function that takes a list like:</p>

<pre><code>x = [1, 13, 14, 9, 8]
</code></pre>

<p>for example and sums the digits like:</p>

<pre><code>1 + (1+3) + (1+4) + 9 + 8 = 27       
</code></pre>

<p>What I have attempted thus far:</p>

<pre><code>def sum_d(x):
    if not x:
        return 0
    else:
        return x[0] + sum_d(x[1:])
</code></pre>

<pre><code>def sumx(x):
    for i in range(0,len(x)):
        if(x[i]&gt;10):
            sum=0
            while(x[i]&gt;0):
                sum+=x[i]%10
                x[i]=x[i]/10
            x[i]=sum
    print(x)
&gt;&gt;&gt; sumx(x)
[5, 4, 5, 9, 8]
</code></pre>

python list python-3.x