Add up all posibilities in a list, with two variables
<p>I am trying to make a program in python that will accept a user's input and check if it is a Kaprekar number.
I'm still a beginner, and have been having a lot of issues, but my main issue now that I can't seem to solve is how I would add up all posibilities in a list, with only two variables. I'm probably not explaning it very well so here is an example:</p>

<p>I have a list that contains the numbers
<code>['2', '0', '2', '5']</code>.
How would I make python do <code>2 + 025</code>, <code>20 + 25</code> and <code>202 + 5</code>?</p>

<p>It would be inside an if else statement, and as soon as it would equal the user inputted number, it would stop.</p>

<p>Thanks</p>

<p>(<a href="http://pastebin.com/Kg9bQq47" rel="nofollow">Here</a> is what the entire code looks like if it helps- where it currently says <code>if  1 == 0:</code>, it should be adding them up.)</p>

<p>Not a direct answer to your question, but you can write an expression to determine whether a number, N, is a Krapekar number more concisely.</p>

<pre><code>&gt;&gt;&gt; N=45
&gt;&gt;&gt; digits=str(N**2)
&gt;&gt;&gt; Krapekar=any([N==int(digits[:_])+int(digits[_:]) for _ in range(1,len(digits))])
&gt;&gt;&gt; Krapekar
True
</code></pre>

python list add