Skip to content

Instantly share code, notes, and snippets.

/application.py Secret

Created March 11, 2017 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/a97f6c4eb5a834f2c99fe9e5f1e919ee to your computer and use it in GitHub Desktop.
Save anonymous/a97f6c4eb5a834f2c99fe9e5f1e919ee to your computer and use it in GitHub Desktop.
application.py - shared from CS50 IDE
def index():
total = 0
cash = db.execute("SELECT cash FROM users WHERE id=:id", id=session["user_id"])
symbol = db.execute("SELECT symbol FROM tracker where id=:id", id=session["user_id"])
rows=lookup(symbol[0])
shares = db.execute("SELECT shares FROM tracker where id=:id", id=session["user_id"])
price = db.execute("SELECT price FROM tracker where id=:id", id=session["user_id"])
return render_template("index.html", cash=usd(cash[0]["cash"]), symbol=symbol[0]["symbol"], \
shares=shares[0]["shares"], price=price[0]["price"], \
cost=price[0]["price"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment