title: Round a Python list of numbers and maintain their sum
body: <p>I have a list or an array of decimal numbers in Python.  I need to round them to the nearest 2 decimal places as these are monetary amounts.  But, I need the overall sum to be maintained, i.e. the sum of the original array rounded to 2 decimal places must be equal to the sum of the rounded elements of the array.</p>
  
  <p>Here's my code so far:</p>
  
  <pre><code>myOriginalList = [27226.94982, 193.0595233, 1764.3094, 12625.8607, 26714.67907, 18970.35388, 12725.41407, 23589.93271, 27948.40386, 23767.83261, 12449.81318]
  originalTotal = round(sum(myOriginalList), 2)
  # Answer = 187976.61
  
  # Using numpy
  myRoundedList = numpy.array(myOriginalList).round(2)
  # New Array = [ 27226.95    193.06   1764.31  12625.86  26714.68  18970.35  12725.41 23589.93 27948.4   23767.83  12449.81]
  
  newTotal = myRoundedList.sum()
  # Answer = 187976.59
  </code></pre>
  
  <p>I need an efficient way of amending my new rounded array such that the sum is also 187976.61.  The 2 pence difference needs to be applied to items 7 and 6 as these have the greatest difference between the rounded entries and the original entries.</p>