19
votes
Accepted
Pset7 - :( quote handles valid ticker symbol
I found a solution here. I didn't format the price of stock by usd(). When I changed my code from {{ price }} to {{ price | usd }} in quoted.html, it worked.
5
votes
Accepted
pset6 tweets, analyze.py and application.py
Maybe a simple typo in tweets here score = analyzer.analyze(tweets), since you want to send one tweet at a time.
Also, beware here: token.lower(). The lower method returns the string in lower case, ...
3
votes
Accepted
pset7 index.html, adding buy/sell button which linked to stock respectively
You can send data back to application.py with a GET method. url_for takes arguments that are sent as a query string. From the flask doc:
flask.url_for(endpoint, **values)
Generates a URL to the given ...
3
votes
Accepted
pset7 finance check50 doesn't detect a valid sale despite portfolio updating correctly
As suggested in a comment, add this to the top of your lookup function in helpers.py
if symbol == "AAAA":
return {"name": "Test A", "price": 28.00, "symbol": "AAAA"}
and then, with a fresh ...
1
vote
Accepted
I'm on pset9 right now and I'm running check50 on my code and getting :( logging in as registered user succeeds expected status code 200, but got 403
This hash = generate_password_hash("password") is a problem. It is hashing the string literal "password". (Try to login using "password" as the password; it should work). ...
1
vote
Accepted
CS50 Finance Internal Server Error RuntimeError: near "' '": syntax error
Recheck line result = db.execute("INSERT INTO USERS (username, hash) VALUES (:username :hash); the values of an INSERT should be separated with commas a la INSERT INTO table_name (column1, ...
1
vote
Accepted
CS50 Finance pset8 KeyError on /buy of application.py
I assume you mean "symbol", not "ticker".
1
vote
Accepted
pset7 application.py: again I am still getting error: The server encountered an internal error and was unable to complete your request. Please help!
It is unlikely you will get an answer to this question because:
There is no specific question. "Internal Server Error" is a generic message when the flask server "fails". Look in the terminal where ...
1
vote
Accepted
Pset6 2017 application.py Sentiments
Yes, in the application.py you need to implement almost the same code as you have written in tweets.
load positive.file and negative.file into memory
analyze each tweet
positive = 0
negative = 0
...
1
vote
Accepted
PSET 7 - Finance - application.py
I'm not certain, but I'd venture to guess that it's for development purposes. You don't want caching to happen because your latest changes may not be reflected on the page; and as for storing the ...
1
vote
pset7 application.py
If you're lucky, the built-in time machine can help.
Open the file, click File -> Show File Revision History to toggle a slider that can warp you back in time.
1
vote
Accepted
A simple question in application.py sentiments
That default value for neutral is merely a placeholder at the start. When you run application.py without implementing it, you see a graph that is 100% neutral. You should initialize those values ...
1
vote
Accepted
register function not returning expected apology results
What is the form action attribute in register.html? Sounds like it's calling login instead of register.
1
vote
New users not being entered into database
Well... figured it out. I forgot to hash the new password. So I added...
hashed = pwd_context.encrypt(request.form.get("password"))
and now it works. Duh.
1
vote
Accepted
cs50 pset7 finance addcash function
request.form.get("var") returns a string.
From the python doc for int():
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer ...
1
vote
Accepted
cs50 pset7 finance index function, index page returns html table with multiple instances of only one transaction
This for holding in holdings: processes the first element in holding, and then returns from the function. The return needs "less indent" so it executes when the for loop is complete.
Warning: stocks ...
1
vote
Accepted
Query for postal code as well as place and admin name in Search route in application.py mashup
Conventional wisdom says that places.postal_code should be a TEXT column in the database. It eliminates all those pesky conversions. It preserves leading 0's in US postal codes, and it is more ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
application.py × 30finance × 13
pset7 × 11
cs50x × 5
pset8 × 4
pset6 × 3
buy × 3
search × 3
register × 3
flask × 2
cs50x2017 × 2
pset9 × 2
quote × 2
sentiments × 2
pset6-sentiments × 2
cs50x2018 × 2
check50 × 1
python × 1
error × 1
cs50-ide × 1
mashup × 1
sell × 1
help × 1
index.html × 1
problem × 1