Although I already did Pset7 finance I wanted to learn something new with python and flask, I find it really interesting but I have the feeling on many occasions that the syntax is little documented, specifically the requests to the database, if I request a value with SELECT using db.execute it seems that I am being returned a dictionary:
diner = db.execute("SELECT cash FROM users WHERE id = :id", id = session["user_id"])
where diner is {'cash': 10000}
then if I want to access the actual value of the current cash, I have to do something like:
available = diner[0]['cash']
then available = 10000 my question is, should not that be enough available = diner['cash']? I do not understand why the first bracket [0] (well I'm a little new in python)