title: Flask doing calculations returns wrong values
body: <p>I am trying to calculate 3 things, profit, total cost and the amount.</p>
  
  <p>A user puts in the amount of coins he/she wants to spend. Each product has a buy price and a selling price, and I need to get, well profit, total cost, and amount. </p>
  
  <p>I am doing that with this piece of code right here:</p>
  
  <pre><code>@app.route('/bflipper', methods=['POST', 'GET'])
  def bFlipper():
      product_name = []
      f = requests.get(
          'https://api.hypixel.net/skyblock/bazaar?key=73ac0a44-4c41-4933-a9ee-b4095be2b6d2').json()
      for x in productNames:
          product_name.append(f["products"][x]["product_id"])
      if request.method == 'POST':
          userInput = request.form['coins'] # UserInput
          userInput = int(userInput)
          sell = [product['sell_summary'][0]['pricePerUnit']
                  for product in f['products'].values() if product['sell_summary']]
  
          buy = [product['buy_summary'][0]['pricePerUnit']
                 for product in f['products'].values() if product['buy_summary']]
  
          amount = []
          for x in range(len(buy)):
              amount.append(userInput * buy[x]) # This here calculates the amount user can buy
  
          total = []
          for x in range(len(buy)):
              total.append(amount[x] * buy[x])# This here calculates the total cost
  
          profit = []
          for x in range(len(buy)): 
              sell_profit = amount[x] * sell[x]
              buy_profit = amount[x] * sell[x]
              total_profit = sell_profit - buy_profit
              profit.append(total_profit) # This here calculates the profit user will make
          return render_template("flipper.html", userInput=userInput, product_name=product_name, profit=profit, amount=amount, total=total, sell=sell, buy=buy)
      else:
          return render_template("flipper.html", product_name=product_name)
  </code></pre>
  
  <p>The issue is that it returns the wrong values, for example:</p>
  
  <p>User puts in <code>'123321'</code> coins. The program will then do:</p>
  
  <pre><code>123321 / buy = amount # how many of product x he/she can buy with 123321 coins.
  amount * buy = total cost # the total cost
  total cost(sell) - total cost(buy) # how much profit it will make
  </code></pre>
  
  <p>Currently, it returns the wrong values. <code>123321 / 4.6 = 26808 (the amount) # 4.6</code> is an example of a product buy price</p>
  
  <p>shows in the browser as: <code>727594</code>. Which is a bit wrong! How do I fix this?</p>