I’m trying to do simple comparison. I want to compare whether or not a transaction from exceeds a value from a sql database. Yet when I compare it. I get the following issue.
TypeError: '<' not supported between instances of 'list' and 'float'
I referenced the other post List comprehension and “not supported between instances of ‘list’ and ‘float” but I’m not sure whether using the filter function would be suitable since it needs a function and a sequence. Any advice? I included my program below:
symbol = request.form.get("symbol")
stock_shares = request.form.get("shares")
#Identifies time of purchase
currTime = time.ctime()
# Yahoo Query for valid stock. Stores values in variables
info = lookup(symbol)
stock_symbol = info.get("symbol")
stock_price = info.get("price")
# Retrieves user data
user_cash = db.execute("SELECT cash FROM users WHERE id IN (?)", session["user_id"])
print("User cash: ", user_cash)
if user_cash < transactionTotal:
return apology("Insufficient funds, 403")
TypeError: ‘<‘ not supported between instances of ‘list’ and ‘float’