title: Python - Iterating through 2 list with arithmetic function
body: <p>I have 2 python list, <em>stock_level</em> to track the amount of inventory and <em>required</em> to indicate the amount of each item in <em>stock_level</em> needed to create each product.</p>
  <pre><code>stock_level = [70, 20, 20 , 20] 
  required = [20, 20, 20, 20]
  </code></pre>
  <p>How do I iterate through the 2 lists to find out how many products can be made and the inventory left outstanding after making the products i.e. given the above value, only 1 product can be made and <em>stock_level</em> should end up to be [50, 0, 0, 0]</p>
  <p>EDIT:
  The products can only be made if all the values in <em>stock_level</em> is greater than <em>required</em>. If,</p>
  <pre><code>stock_level = [20, 20, 20, 20]
  required = [70, 20, 20, 20]
  </code></pre>
  <p>No products should have been made as the first element in <em>stock_level</em> is lesser than the first element in <em>required</em>. A product should only be made if the value in <em>stock_level</em> is greater than the corresponding element in <em>required</em>.</p>
  <pre><code>stock_level = [70, 20, 20, 20]
  required = [20, 20, 20, 20]
  </code></pre>
  <p>In this example, only 1 product should be made as after the first run, <em>stock_level</em> will become [50, 0, 0, 0] and there won't be enough inventory in the 2nd to 4th element of <em>stock_level</em> to make another product.</p>
  <p>I came up with something like this.</p>
  <pre><code>made = 0
  for x in required:
      for y in stock_level:
          while True:
              if x &gt; y:
                  print(&quot;Insufficient&quot;)
                  break
              else:
                  # stock_leve minus required
                  print(&quot;Product created&quot;)
              made += 1
  </code></pre>