0

I completed Finance and everything seems to be working for me but when I use check50 it gives error.

https://submit.cs50.io/check50/9d1a3517645a1207b1792d521c920386d586caf0

As you can see it shows error in quote it wants to see 28.00 in page but there is no 28.00 quote in IEX. enter image description here

Also it says that buy is unable to handle a valid purchase but I have bought 15 shares of NFLX already.

enter image description here

As you can see I bought 15 shares then I again bought 1 more share

enter image description here enter image description here

2
  • hey! i am also stuck in birthdays and finance question. rest other questions along with project i have completed. can you kindly help me with the code?pls – user31732 Jan 26 at 12:48
  • I have also not solved this myself. But since I got a grade above 70% so I left it. But if you want, you can send your problem on my discord – TSPR 810 Jan 27 at 7:44
0

Check50 gives you all the hints you need for fixing your code. I haven't done this set but this is what I understand:

  • The first incident means that you used a value instead of a symbol.

  • The second one says that you don't check for negative values (-23) or non-numeric values (abc).

  • The third one looks similar to the first one.

I assume that you have to work a little bit more with validation on the server-side, and test the functionality with what is not expected (mimic a user you cannot trust).

3
  • Well, the code does check for non numeric values and all. But I do not understand what you have said for the first error – TSPR 810 Jan 5 at 11:34
  • @TSPR810 The check performs a test on /quote for a symbol and expects to find within your response the specified value. The symbol does not necessarily need to be one from your portfolio. Therefore there is something wrong with your quote function. – vpgr Jan 6 at 18:50
  • I understand that but what it is that check is trying to find? I want to know that so that I can check the loopholes in my code – TSPR 810 Jan 7 at 3:30
0

Your dollar values should be formatted to 2 decimal places. See the first Hint in the spec about using the usd filter.

10
  • Well, that did it for quote but buy is still not working. I don't understand why. It says that I should run it with --log but when I run it with that it shows something that I don't understand – TSPR 810 Jan 7 at 7:24
  • You formatted all dollar values (the price, the total)? If that didn't fix it, have you made any changes to helpers.py that might not be picked up by check50? – curiouskiwi Jan 7 at 21:24
  • submit.cs50.io/check50/26ae6fea26b11588fbd76aaf00aff8fb77893190 This is the check50 error it is showing. It says that buy can't handle a valid purchase but as I had shown it I have been buying stocks and selling them. – TSPR 810 Jan 8 at 3:54
  • So that's a new error. Your buy is crashing because you are trying to call isdigit() on an int. – curiouskiwi Jan 8 at 7:21
  • I commented isdigit() but still it doesn't work – TSPR 810 Jan 8 at 7:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .