title: How to divide an unknown integer into a given number of even parts using Python
body: <p>I need help with the ability to divide an unknown integer into a given number of even parts — or at least as even as they can be. The sum of the parts should be the original value, but each part should be an integer, and they should be as close as possible.</p>
  
  <pre><code>Parameters
  num: Integer - The number that should be split into equal parts
  
  parts: Integer - The number of parts that the number should be split 
  into
  
  Return Value
  List (of Integers) - A list of parts, with each index representing the part and the number contained within it representing the size of the part. The parts will be ordered from smallest to largest.
  </code></pre>
  
  <p>This is what I have </p>
  
  <pre class="lang-py prettyprint-override"><code>def split_integer(num,parts):
      if (num &lt; parts):
        print(-1)
  
      elif (num % parts == 0):
        for i in range(parts):
          print(num // parts),
      else: 
        parts_remaining = parts - (num % parts)
        quotient = num // parts 
  
        for i in range(parts):
          if (i &gt;= parts_remaining):
            print(quotient + 1),
          else:
            print(quotient),
  
  split_integer(10, 1)
  </code></pre>
  
  <p>This is the sample tests</p>
  
  <pre><code>import unittest
  
  class Test(unittest.TestCase):
      def test_should_handle_evenly_distributed_cases(self):
          self.assertEqual(split_integer(10, 1), [10])
          self.assertEqual(split_integer(2, 2), [1,1])
          self.assertEqual(split_integer(20, 5), [4,4,4,4,4])
  </code></pre>
  
  <p>Examples of the expected output</p>
  
  <pre><code>num parts   Return Value
  Completely even parts example   10  5   [2,2,2,2,2]
  Even as can be parts example    20  6   [3,3,3,3,4,4]
  </code></pre>
  
  <p>I am getting the error </p>
  
  <pre><code>Failure
  AssertionError: None != [10]
  </code></pre>