@app.route("/buy", methods=["GET", "POST"])
@login_required
def buy():
"""Buy shares of stock"""
if request.method == "GET":
return render_template("buy.html")
else:
if not request.form.get("symbol"):
return apology("missing symbol", 400)
if not request.form.get("shares"):
return apology("missing shares", 400)
symbol = request.form.get("symbol")
shares = request.form.get("shares")
lis = lookup(symbol)
cost = lis["price"]
price = cost * shares
return render_template("test.html", price=price)
error
price = cost * shares
TypeError: can't multiply sequence by non-int of type 'float'