Questions tagged [pset7]

For problem set 7 (CS50 Finance)

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

Submit50 for pset7 movies loads SQL files but returns “Error when executing query: missing statement”

When I execute: submit50 cs50/problems/2020/x/movies All my SQL files are sent for grading and all come back with the same error: Error when executing query: missing statement I have tried the sql ...
0
votes
1answer
25 views

PSET 7 Movies SQL Q9

In 9.sql, write a SQL query to list the names of all people who starred in a movie released in 2004, ordered by birth year. ...Your query should output a table with a single column for the name of ...
0
votes
0answers
12 views

“Error when executing query: too many statements at once” pset 7 movies

Hi! I wanted to know what this error message meant because all my sql statements give the correct output but submit50 shows that i've only got a 2/14 , "Error when executing query: too many ...
0
votes
1answer
9 views

Why updating a dictionary is not working?

for row in rowsList: if row['middle'] is None: row['middle'] == "" print("{} {} {}, born {}".format(row['first'], row['middle'], row['last'], row['birth'])) Where ...
0
votes
1answer
17 views

PSET 7 HOUSES - Syntax error on case function

I'm trying to select the first name and last name and ONLY select the middle name when there is one. The logic of my query makes sense. Every time I am extracting the first name, last name, and birth. ...
0
votes
1answer
12 views

When I run the testing code, it says that movies.db does not exist. How should I fix it?

This is my code in the terminal: cat 1.sql | sqlite3 movies.db This is the output: Error: near line 1: no such table: movies.db
0
votes
1answer
39 views

CS50 Houses : Output is correct in my console but error in check50

I am working on the CS50 course by Harvard EDx. The output for CS50 - Houses is correct in my console. However, check50 which is validates and evaluates the response gives an error. I have checked the ...
0
votes
1answer
37 views

Pset7 houses - why does my output prints thrice instead of once?

The code is as follows: for row in students_list: first, middle, last, birth = row["first"], row["middle"], row["last"], row["birth"] print(f"{...
0
votes
1answer
27 views

pset7 Q10 Weird Result

The challenge is apparently straightforward: write an SQL query to list the names of all people who have directed a movie that received a rating of at least 9.0. To get from names (which lives in the '...
0
votes
1answer
57 views

PSET 7 movies 5.sql check50 not giving the actual output correctly

the check50 output doesn't match sqlite3 output. the code runs and outputs 10 rows in sqlite3 and DBsqlite but check50 output is different.
0
votes
1answer
31 views

How to exclude 'Kevin Bacon's' name from query table?

i have tried to exclude the name from the list but most of the solution aren't doing anything. anyone have idea how to solve. SELECT name FROM movies JOIN stars ON movies.id=stars.movie_id JOIN ...
0
votes
1answer
54 views

Pset7 (Movies) 12.sql: Table outputs 96 rows rather than 5 rows

I've been stuck on this for quite some time and did a lot of research on the AND operator in SQL, but no matter how many variations I try I cannot get my table to output just 6 rows, with each row ...
0
votes
0answers
18 views

Not able to sort the fetched values of chadwick boseman movies

SELECT title FROM movies WHERE movies.id IN ( SELECT ratings.movie_id FROM ratings WHERE ratings.movie_id IN ( SELECT stars.movie_id FROM stars where stars.person_id = ( SELECT people.id FROM ...
0
votes
1answer
62 views

PSET 7 Movies 12.sql

can someone explain the difference between using IN and "="? Here is my code. When I use IN it runs perfectly but when I use "=" there is no output. Thank you! SELECT title FROM ...
0
votes
1answer
59 views

PSET 7 - 6.sql, terminal just hangs

PSET 7 for 6.sql, Terminal just hangs when I execute it. Can anyone tell me why this wouldn't work? I've tried every variation I could think of (and several I found online) for this and none of them ...
0
votes
0answers
55 views

pset7/houses: db.execute(“INSERT”) fails to export data to students.db

I am using pandas to read in the csv file, since I'm familiar with dataframes from R. But I think that may not be the issue here, which is that db.execute fails to export data to students.db. The code,...
0
votes
1answer
41 views

pset7 houses printing the error message if wrong usage

The commandline argument check in roster.py: A bit strange, I find whatever I am doing I can't get this error message to print, the function will shut down alright, but no error message, I have tried ...
0
votes
1answer
70 views

Pset7 Movies Q12: I don't get what's wrong

I can't figure out why my pset7 movies Q12 code isn't working. Can anyone tell me why? Here is my code: SELECT DISTINCT title FROM movies, stars, people WHERE movie_id IN (SELECT movie_id FROM stars ...
0
votes
1answer
119 views

Misuse of aggregate function CS50 Pset 7 10.sql

I'm stuck on pset7 10.sql, it keeps coming up with a misuse of aggregate function. My code is currently: SELECT name FROM people INNER JOIN directors ON people.id = directors.person_id INNER JOIN ...
0
votes
1answer
57 views

CHECK50 Bug in pset7: movies SQL

I have been banging my head on this for an hour and half. Finally finished the pset, uploaded it. Check 50 says: Now, both cs50 ide and DB browser return the correct results, and number of lines for ...
0
votes
1answer
111 views

Houses ~ Import.py - Nothing being inserted into students.db

The following is my code: import csv from sys import argv import sqlite3 import os.path def main(): #Check if correct number of arguments were provided by the user if len(argv) != 2: ...
0
votes
1answer
34 views

pset7 Q7: How many actors are named “Meryl”?

I am at a complete loss for something that should be very simple to find in SQLite. In the IMDB database, I have to find how many actors have the name 'Meryl', I have tried select name, count(name) ...
0
votes
1answer
77 views

pset7 Houses get 17% submit

My code run right and My output same they output but after submitted get 17% why //import.py from sys import argv, exit import cs50 import csv if len(argv) != 2: print("...
0
votes
1answer
22 views

I am working through roster.py, but the first line in the solution is not printing in my output. why is this happening?

import cs50 import sys import sqlite3 db = sqlite3.connect("students.db") house_reader = db.cursor() if len(sys.argv) != 2: print('Usage: import.py file.csv') exit() house_reader.execute("...
0
votes
1answer
96 views

PSET7 Movies Q8 - Why these queries return different results?

I'm working on pset7 movies problem of the CS50 course and I have a question regarding 8.sql, which asks to write a SQL query to list the names of all people who starred in Toy Story. To my ...
0
votes
1answer
117 views

Pset 7 Movies - 13.sql “Error When Executing Query - Too Many Statements at Once”

I'm working on Pset 7 "Movies" and check50 shows an error for 13.sql (list of Kevin Bacon's co-stars) when I submit my code despite running successfully in the IDE. The exact error message is Error ...
0
votes
0answers
23 views

Pset7 buy route error due to API use by lookup function

I am experiencing an error each time I call the lookup function within the buy route when the request method equals post. However, calling lookup during quote does not result in the same error. I ...
0
votes
1answer
49 views

Pset7 Houses, what does my error message mean?

Whenever I run my code, I get a strange error message because of my code. It is because of my SQL code, but I followed all of the instructions, and even tried some other SQL code, which worked ...
0
votes
0answers
67 views

Problem with check50 in pset7 houses

I am getting the correct result when I am executing from the terminal but when I am submitting than it is behaving strangely. MY CODE
0
votes
1answer
238 views

pset7/movies/13.sql: exclude Kevin Bacon from the resulting list

In pset7/movies, I want to dynamically exclude Kevin Bacon from the resulting list (e.g. not specifically mentioning his name with NOT or EXCEPT or copying and pasting code that calculates his ID, so ...
0
votes
1answer
94 views

Problem with Check50 in pset7

I have a problem when I use check50 in speller pset7. I get 1/6 as a final score, but when i run the code in the ide, I get the correct output, but the speller says its a wrong answer. enter image ...
0
votes
1answer
219 views

How to test pset7 queries in the terminal window?

I am trying to test the queries I've saved in files i.e. 1.sql, 2.sql,.... But I can't able to test them in the terminal window. The command given in the instruction is not showing any results. ...
0
votes
0answers
110 views

SQL error pset7 houses

with open(argv[1],"r") as inp: reader = csv.DictReader(inp) for row in reader: lis = row["name"].split() print(len(lis)) if (len(lis) == 2): print(row["...
0
votes
1answer
405 views

Pset7 8.sql is not giving output

i am in problem set 7 now, and i'm stuck in '8.sql'. Specifications is to write a SQL query to list the names of all people who starred in Toy Story. When i run my code, i get no output, i have ...
0
votes
1answer
218 views

Reason for error pset7

There seems to be a problem with the sql line but idk whats wrong. from cs50 import SQL, get_string from sys import argv import csv db = SQL("sqlite:///students.db") if (len(argv) != 2): exit() ...
0
votes
1answer
306 views

Reason for error pset7 houses

from cs50 import SQL, get_string from sys import argv import csv db = SQL("sqlite:///students.db") if (len(argv) != 2): exit() with open(argv[1],"r") as inp: reader = csv.DictReader(inp) ...
0
votes
1answer
138 views

My code pset7 houses pass all check but just take 17% on progess?

I don't know why my code pset7 houses pass all check but when i submit it i just take 17% on progress. Who can help me?. This my code: import.py from cs50 import SQL import csv import sys def main(...
1
vote
1answer
168 views

Why isnt it printing out the average?(pset7 7.sql)

SELECT AVG(rating) FROM ratings WHERE ratings.movie_id = (SELECT id FROM movies where movies.year = 2012); It doesnt seem to print anything.
0
votes
1answer
219 views

pset7 houses printing none instead of last name and extra space

Trying to finish roster.py and my output is incorrect. It prints the None instead of the last name and I am getting and extra space after the last printed name, such as "None , born 1981" or "Jean , ...
1
vote
1answer
534 views

roster.py not getting output

import sys import cs50 # checking argv (that there's one and it's a csv) if (len(sys.argv) != 2): sys.exit("Usage: roster.py house_name") housename = sys.argv[1] #print(house_name) #open(f"...
1
vote
2answers
2k views

PSET7 Movies Q9: Why is my number of rows generated different from what the assignment requires?

Here are the parameters for running a SQL query in the file 9.sql: In 9.sql, write a SQL query to list the names of all people who starred in a movie released in 2004, ordered by birth year. ...
0
votes
1answer
76 views

Not too sure what I did wrong

My program runs fine with the give parameters and outputs what is needed. Students.db also contains the right values. Even after reading a thread similar to this, I still don't know what I did wrong. ...
0
votes
2answers
611 views

pset7 - Houses problem with check50

I'm running into some issue with check50. I know it's been ask before but the answer of some other topic do not apply to me. I re-do both files but still getting the same output. This is my output ...
0
votes
1answer
214 views

pset7 houses ISNULL function

I want to replace all NULL value by nothing('') in an output query. Note: I don't want to replace the NULL by nothing in the table. SELECT row1, row2, row3 ISNULL(row1,'') AS row1 FROM table output ...
0
votes
1answer
413 views

pset7 houses: dict to SQL

I need to pass a python dict to a database with SQL. one of my dicts is: print(student[1]) {'first': 'Adrian', 'house': 'Slytherin', 'birth': '1977', 'middle': 'NULL', 'last': 'Pucey'} I want to ...
0
votes
1answer
310 views

PSET7 cs50 import SQL

I'm looking for the documentation about the module CS50 SQL imported in python. Where can I find all the commands ? Thanks in advance,
1
vote
2answers
2k views

pset7 movies Q12

I'm stuck in PSET7 SQL part 1 question 12: I want to list all movies with 2 people inside. The JOIN of the 3 table is set, the problem is in my WHERE statement: WHERE people.name = 'Johnny Depp' ...
0
votes
1answer
1k views

Pset7 Houses Issue

I thought I had this one figured out, but check50 disagrees. The specification suggests that the output needs to be formatted as "Harry James Potter, born 1980 or Luna Lovegood, born 1981." To ...
0
votes
1answer
17 views

Can' get alert() to work in Survey

I wanted to alert the user if he hasn't filled out the name field of my form using Javascript. But when I hit submit without filling the name, the alert doesn't popup. Here's my code {% extends "...
0
votes
0answers
16 views

Why is /sheet is absolutely blank?

Nothing is appearing on /sheet, not even the header. However, the .csv file is generating as intended. Can you help figure out what is wrong with my process? {% extends "layout.html" %} {% block ...

1
2 3 4 5
15