title: Adding 1 to last value of a list
body: <p>I am trying to add 1 to the last value in a <code>list</code>. <code>list[-1]</code> should give me the last value. Code below:</p>
  
  <pre><code>def plusOne( l):
      for idx, item in enumerate(l):
        l[-1]=l[-1]+1
      return l
  
  print(plusOne(v))
  </code></pre>
  
  <p>Problem: Upon running the code the answer I get it <code>v=[4,3,2,5]</code> when I was expecting <code>v=[4,3,2,2]</code>. This works when I use <code>[1,2,3]</code> to test. When I put a breakpoint on <code>l[-1]</code> line I see:</p>
  
  <pre class="lang-none prettyprint-override"><code>idx 0 item 4
  idx 1 item 3
  idx 1 item 3
  idx 2 item 2
  idx 3 item 4
  </code></pre>
  
  <p>Can someone kindly explain why it works for <code>[1,2,3]</code> and not <code>[4,3,2,1]</code>?</p>