How can I define a function that takes a list of numbers and adds the first and last digits in Python 2.7?
<p>//this is what i tried</p>

<pre><code>def addFirstAndLast(x):
     return x[0] + x[-1]
</code></pre>

<p>//thought it would be as simple as that</p>
