old_contents: def maxprofit(stockvalues): 
      maxval, res = 0, 0
      for i in range(len(stockvalues) - 1, -1, -1):
          maxval = max(maxval, stockvalues[i])
          res += maxval - stockvalues[i]
      return res
  
  stockvalues = [1, 3, 1, 2, 4]
  print "Profit was: " + str(maxprofit(stockvalues))
  
new_contents: def maxprofit(stockvals): 
      maxval, profit = 0, 0
      for stockval in stockvals[::-1]:
          maxval = max(maxval, stockval)
          profit += maxval - stockval
      return profit
  
  stockvalues = [1, 3, 1, 2, 4]
  print "Profit was: " + str(maxprofit(stockvalues))
  
subject: Update MaximizeStockets.py