 <p>For academic purposes (learning Python) you could use recursion:</p> <pre><code>def getSum(iterable): if not iterable: return 0 # End of recursion else: return iterable[0] + getSum(iterable[1:]) # Recursion step </code></pre> <p>But you shouldn't use recursion in real production code. It's not efficient and the code much less clear then with using built-ins. For this case you do not need neither recursion nor loop. Just use built-in <a href="https://docs.python.org/2/library/functions.html#sum" rel="nofollow">sum</a>:</p> <pre><code>&gt;&gt;&gt;a = [1, 2, 3, 4, 5] &gt;&gt;&gt;sum(a) 15 </code></pre>