title: Get last item from a list as integer/float
body: <p>Very simple question, I have a list like so:</p>
  
  <pre><code>a = [0,1,2,3,4,5,7,8]
  </code></pre>
  
  <p>and I need to get the last item in that list as a float or an integer. If I do:</p>
  
  <pre><code>print a[0], a[4]
  </code></pre>
  
  <p>I get <code>1 5</code>, which is fine, but if i try to retrieve the last item with:</p>
  
  <pre><code>print a[-1:]
  </code></pre>
  
  <p>I get the <em>list</em> <code>[8]</code> instead of the <em>number</em> <code>8</code>. I know that I could just use <code>print a[len(a)-1]</code> but it feels kind of overkill and now I also have the doubt of why is <code>a[-1:]</code> returning a list instead of an element?</p>