title: How do i calculate the percentage increase or decrease in a list of values with python
body: <p>I want to calculate the percentage change either increase or decrease in a list.
  here is my list
  ages = [20.3, 30.5, 20.3, 45.5, 50.6, 29.5, 13.4, 140.9]</p>
  <p>here is my code</p>
  <pre><code>def percent_change_in_naira(value):
    try:
      for i in value:
          if old_num &gt; new_num:
            ((((old_num-new_num)/old_num)*100))
          elif old_num == new_num:
            0
          else:
            ((((new_num-old_num)/old_num)*100))
      return value
    except ZeroDivisionError:
          return 0
  </code></pre>
  <p>How do assign 'new_num' to a new number on the list above and 'old_num' to a previous number on the list above?</p>
  <p>Thanks in advance</p>