title: Unsupported operand type in Python
body: <p>I wrote a very simple script to get the product quantity, cost and average of a purchase:</p>
  
  <pre><code>from __future__ import division
  
  def print_purchase(arg1, arg2, arg3):
      print """You bought %r products and paid %r,
               for an average of %d""" % (arg1, arg2, arg3)
  
  quantity = raw_input("How many products did you buy?")
  cost = raw_input("How much did you pay?")
  average = quantity/cost
  
  print_purchase(quantity, cost, average)
  </code></pre>
  
  <p>It works until it has to perform division. I tried 'modifying' the code in a few ways so it could perform these operations (importing division, etc.), but I still can't make it work:</p>
  
  <pre><code>Traceback (most recent call last):
    File "purchase.py", line 9, in &lt;module&gt;
      average = quantity/cost
  TypeError: unsupported operand type(s) for /: 'str' and 'str'
  </code></pre>