Questions tagged [index]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
17 views

Finance - Index showing correct number of rows but all the same record. For- loop issue?

So I've been looking at this all morning and can't figure what I'm doing wrong. All my variables are producing the correct values so it seems to be something to do with my For loop. In the html ...
0
votes
1answer
21 views

FINANCE: GROUP BY doesn't add up the numbers of shares of the same stock

So in index i'm trying to display a table with all the stocks that the user has bought, one row for each stock, displaying the total number of shares in the user's portfolio along with the total value ...
0
votes
1answer
35 views

Problem Set 8 / Finance. How to incorporate current price (index)

I'm currently struggling with index(). In buy() I created the custom table with, one might say, too many columns. Among others are symbol, name, shares, price, total. So far I was able to plug some of ...
1
vote
1answer
46 views

CS50 Finance: Index - list indices must be integers or slices, not str

I've been stuck on this for quite some time. I believe that I'm getting back data in the form of a dictionary but can't figure out how to get the information that I need. Error messages that have ...
0
votes
1answer
72 views

Finance index function does not return lookup value in index.html

I'm trying to render my lookup values inside of my index function implementation, but I cannot get these values to render in my index.html page. I added share = lookup(record['share_symbol']) to grab ...
0
votes
1answer
26 views

Finance index.html is not rendering values from my index function

I'm having some issues trying to render values on my index.html page. In my index function, I created a dictionary of values from my transactions table to grab each record of my share symbols, share ...
0
votes
1answer
27 views

Runtime error in pset4

I'm currently working on filter.c, and I'm struggling with the blur segment of it. I tried to write a code (I'm aware it's a mess of hard-code, but it's an attempt!), but I keep getting this error: ...
0
votes
1answer
25 views

Finance Portfolio (index) I can't go on. Need to take to HTML the actual price and total of stock

I am stopped at this part of Finance now. I can print at HTML the symbol and the sum of the shares... but I don't know how to take the iteration for each symbol to the HTML to know the actual price ...
1
vote
2answers
49 views

My Coleman-Liau index gives the wrong answer

the program seems to be running fine but I don't know what went wrong in the index, it just doesn't give the right answer. #include <cs50.h> #include <stdio.h> #include <string.h> #...
0
votes
1answer
63 views

Finance - Error with Index

I can't seem to figure out where I've gone wrong with index. I keep running into these two errors: After login, when directing to index - 500: Internal Server Error (raise TypeError("...
0
votes
0answers
165 views

pset8 finance index

I'm currently working on pset8 Finance, and I'm having problems with index.html. It looks like my python function works well, but when I apply multiple buyings the relevant page shows only the first ...
0
votes
1answer
55 views

Pset8 Finance - SELECT is blank

Stock holdings are not printing on my index webpage. "cash" prints correctly. I think the SELECT on my finance.activity table is somehow coming up blank. I am not receiving any errors, and when I ...
0
votes
1answer
130 views

Pset8 finance, index not working after migrating to new IDE, why?

My "index" was working fine, but it no longer works and i get the 500 internal server error now, which has been happening after migrating to the new IDE. I does not seem to be my code. Here is what ...
0
votes
1answer
76 views

Pset7 - index() ValueError: could not convert string to float

I got ValueError: could not convert string to float at line 66 grand_total = total_holdings + float(current_cash[0]["cash"]) Can anyone show me my mistake? current_cash[0]["cash"] returns a string....
0
votes
1answer
288 views

pset7 finance: index not working after register

I have an issue with my index function after a user newly registers. After registering, a new row is created in the table users with a cash value set to 10000 by default. After registering, the user ...
0
votes
1answer
32 views

When I go to '/' page for Finance it only shows the cash I have available

I've been struggling for hours with trying to get the '/' page to display the current portfolio. It displays the remaining cash fine but nothing else. On phpliteadmin I can see that the table gets ...
0
votes
1answer
114 views

pset7 index function won't iterate through stocks

I'm having some serious trouble getting the index function to iterate through each of the user's stocks to obtain the current market price. It correctly outputs a list of the user's stocks along with ...
0
votes
1answer
802 views

Pset7 index TypeError: quote_from_bytes() expected bytes

Pset7 index. I’m getting raise TypeError("quote_from_bytes() expected bytes") TypeError: quote_from_bytes() expected bytes. I tried several times to rewrite the code but I always come across this ...
0
votes
1answer
124 views

Pset7 index RuntimeError object has no attribute name

I’m working on index part for two days now and I’m keep getting AttributeError: 'RuntimeError' object has no attribute 'name'. I changed things around but still the same error. Please, help me.
0
votes
1answer
55 views

Pset7 finance, after I run buy function, portfolio table updated check 50 fails and I get 404 error

after I run check 50, everything shows green except these: I am trying to fix the error for buy. After I run flask and tried to make purchase, it shows 404 however my portfolio table get updated. So ...
0
votes
1answer
618 views

pset7 finance register and index check50 error

I have implemented all functions. However when i run check50, it gets following errors The errors might come from my index code. I am not sure. Below are my code for register and index. Any ...
0
votes
1answer
411 views

Problem retrieving index variables in finance

The table is not able to access different variables to display in the table. Here is the index function def index(): """Show portfolio of stocks""" """Selecting shares that have been purchased ...
0
votes
1answer
28 views

TypeErrors and variable storage questions

I have been struggling with this problem set (pset7) for a couple weeks now and I have looked at countless resources while trying to get my code working. I am the point where I do not remember what is ...
0
votes
2answers
512 views

pset7 finance/index problem updating values in table

First time asking question, sorry if formatted badly. I am trying to set up to update my price and total column in my sql table. I seem to have it mostly correct, as values are being updated properly, ...
0
votes
1answer
208 views

pset7 index table not showing all values

When I try to use index, the table doesn't show all the values: [![erroneous table][1]][1] I'm not sure why it only shows some. My index code is as follows: def index(): """Show portfolio of ...
0
votes
1answer
58 views

why can't I even log in now ? pset7

code: def index(): """Show portfolio of stocks""" portfolio_symbols = db.execute("SELECT shares, symbol \ FROM log WHERE id = :id", \ ...
0
votes
1answer
142 views

pset7 index TypeError: 'NoneType' object is not subscriptable error

Me again with this error. I do not know what happened, this has been working for a couple of weeks and I have not changed the code (though I did copy and paste it) but all of a sudden this afternoon I ...
0
votes
1answer
63 views

pset7 “index” - using SQL SUM adds a parenthesis to returned dict strings

I executed the following to return a dict (grouped by stock symbols) of stock symbols, total shares and total value owned. stocks = db.execute("SELECT buy.stock_code, SUM(buy.value), SUM(buy.shares) ...
0
votes
1answer
84 views

Pset7 Finance Unable to Buy Multiple Shares

I am able to make 1 purchase which appears on my index page, however if I try buy any further stocks my cash goes down but the stocks are not shown and aren't inserted into my portfolio. Here is my ...
0
votes
1answer
437 views

pset7 index fields are empty in page

When I logged into the webpage and bought a stock, the price of the stock was deducted from the cash balance. However, the details of all the other fields are missing as shown in the picture below. I ...
0
votes
1answer
106 views

cs50 pset7 finance always get an error in valid buy execution;;;;;

@app.route("/") @login_required def index(): """Show portfolio of stocks""" cash = db.execute('SELECT cash FROM users where id=:id',id=session["user_id"]) cash = cash[0]["cash"] stocks ...
0
votes
1answer
283 views

pset7 - Buy doesn't return correct value

I've ran into an issue while running Check50 on what I thought was my functioning solution for pset7, namely it doesn't find the correct value in the index after trying to run the buy function. This ...
1
vote
2answers
163 views

Pset7 => “NoneType” error on SELECT query (2017)

I’m really stuck on the index part of PSET7…. Flask keeps iterating over the following SELECT query: dab = db.execute("SELECT SUM(share) FROM portfolio WHERE symbol = :symbol AND user_id = :user_id",...
1
vote
2answers
4k views

pset7 index TypeError: 'NoneType' object is not subscriptable

I'm working on pset7 index, and I've hit a snag. When I try to log in and render index, I get this error: TypeError: 'NoneType' object is not subscriptable It says the main error is on line 50: name =...
0
votes
1answer
131 views

pset7 index only one stock gets passed into html

My code for index is at https://pastebin.com/Ct7xCdYv. My code for html is at https://pastebin.com/VFFAWEzc Currently, I'm just trying to get the code for the stocks in, and will then tackle adding ...
0
votes
2answers
284 views

Querying portfolio for index route PSET7/C$50 Finance/index

I have created a table named "portfolio" in my database which stores users purchase data while I kept the user_id field of this table NOT UNIQUE ie no primary key so as to let the user buy more same ...
0
votes
1answer
335 views

Pset7 Index not outputting some fields in table

I am in desperate need of help, since the index method is the last method I have left to finish for this pset! So far, my index code works partially - as in, only the values I passed in from my ...
1
vote
1answer
176 views

Why is my table in index.html pset7 showing up blank? (for dummies)

I've been stuck on this for a couple hours now, it seems that whatever I put into my for loop in my index for html doesn't print at all? Thoughts? index method: def index(): portfolio = db.execute("...
0
votes
2answers
124 views

pset 7 [buy] Unable to render user's cash

I've spent a lot of time trying to solve this problem and can't seem to find were I went wrong. Any help is greatly appreciated. I am unable to render the user's cash balance on the index. def ...
0
votes
1answer
306 views

Index Pset7 - Symbol, Shares, and Total show [] instead of value

I was able to successfully create my index table and it shows the Name and Price correctly. However, it only shows [] for the values of Symbol, Shares, and Total. Here is my code: // edited out I'...
0
votes
2answers
2k views

pset2 caesar converting from ascii to alphabetical

#include <stdio.h> #include <cs50.h> #include <stdlib.h> #include <string.h> #include <ctype.h> int main(int argc, string argv[]) { if (argc == 2) { int ...
1
vote
1answer
50 views

pset2 Initials - negative index

I finished the Initials (more comfortable) problem, but when trying to detect initials, I'd like to avoid negative indeces. Here's what I used for the detection of initials, if it's not a space at ...
1
vote
1answer
32 views

Pupose of index in speller.c

What's the use of index in speller.c and where it is declared? I can't understand how it is used in the speller.c.
1
vote
2answers
323 views

CS50 Pset7: rows inside the for loop are not showing up in index.html

I have been trying to implementing my code for Index and index.html. My code for Index seems to work very well, but my index.html isn't. My implementation of index() and index.html are pasted below. ...
0
votes
1answer
102 views

CS50 Pset7: rows inside the for loop aren't showing up in index.html

I have been trying to implementing my code for Index and index.html. My code for Index seems to work very well, but my index.html isn't. The jinja template is pasted below. For some reasons, the table ...
0
votes
1answer
89 views

PSET 2 - Vigenere's cipher: Index of key's current letter not working properly

I know that I've posted a question very recently about the same PSET, but I've encountered another problem and I've been trying to solve it for hours. Sorry if I'm wasting anyone's precious time. My ...
0
votes
1answer
138 views

How to figure out “Who bought what and whe?” - pset7 - buy - index

I can't seem to wrap my head around what should be the primary key in my Portfolio table. I am able to get a quote, buy a stock, and have the price taken from the corresponding user but my Portfolio ...
0
votes
1answer
96 views

Problem with Total (stock price * number of shares) and Number of Shares Value in Portfolio on Index

Just recently, on my implementation of CS50 Finance, I bought 4 shares of Netflix, and then another 2, but instead of showing 6 shares on the Portfolio, it's only showing 2.  The "Total" value for the ...
0
votes
1answer
51 views

Sorting a List Based on Stock Symbols in CS50x2017 Problem Set 7 Index

Would this be the way to sort a list of stock information with sorted using stock symbols as the key to sort on? new_translactions_info = sorted(transactions_info, key=lambda transactions_info: i....
1
vote
1answer
552 views

pset 7 index - how to get total value of shares held and add to cash balance

Still working on index in pset 7. I am able to display details of the shares held by the user and their cash balance in a table. I have done this by iterating over their holdings in a portfolio table, ...