title: Writing a function that alternates plus and minus signs between list indices
body: <p>In a homework set I'm working on, I've come across the following question, which I am having trouble answering in a Python-3 function:</p>
  
  <blockquote>
    <p>"Write a function alternate : int list -> int that takes a list of
    numbers and adds them with alternating sign. For example alternate
    [1,2,3,4] = 1 - 2 + 3 - 4 = -2."</p>
  </blockquote>
  
  <p>Full disclosure, the question was written with Standard ML in mind but I have been attempting to learn Python and came across the question. I'm imagining it involves some combination of:</p>
  
  <p>splitting the list,</p>
  
  <pre><code>if [i] % 2 == 0:
  </code></pre>
  
  <p>and then concatenating the alternate plus and minus signs.</p>