Hey everyone,<br>I'm working on one of the puzzles on <a href="http://pyschools.com">pyschools.com</a>, and am trying to figure out if I can make my solution a bit more elegant.<br><br>def getSumOfLastDigit(numList):<br>
sumOfDigits=0<br>    for i in range(0, len(numList)):<br>        num=str(numList.pop())<br>        sumOfDigits+=int(num[-1:])<br>    return sumOfDigits<br><br>Below is the problem. Basically you take the last digit of each number in the list, and add them together.<br>
<br><p>
Write a function: getSumOfLastDigit(numList) that takes in a list
of positive numbers and returns the sum of all the last digit in the list.

</p>
<p>
<b>Examples</b></p><div class="highlight"><pre>   <span class="o">>>></span> <span class="n">getSumOfLastDigit</span><span class="p">([</span><span class="mi">12</span><span class="p">,</span> <span class="mi">23</span><span class="p">,</span> <span class="mi">34</span><span class="p">])</span><br>
<span class="mi">9</span><br>   <span class="o">>>></span> <span class="n">getSumOfLastDigit</span><span class="p">([</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">])</span><br>
<span class="mi">9</span><br>   <span class="o">>>></span> <span class="n">getSumOfLastDigit</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">23</span><span class="p">,</span> <span class="mi">456</span><span class="p">])</span><br>
<span class="mi">10</span><br><br></pre></div><br>