Python use as loop to make a formula : <p>I want to use a loop to make a formula. I will be adding pandas columns but the number of columns I'll add depends on a condidition within the loop.</p>

<p>For example</p>

<pre><code>l=[1,2,3,4]
s='a='
out=''
for i in l:
    out=out+'+'+str(i)
</code></pre>

<p>In this example s+out should equal <code>10</code> and not <code>'a=+1+2+3+4'</code></p>
