Questions tagged [pset7]

For problem set 7 (CS50 Finance)

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

Fiftyville: Can't find a logical way to find the thief

I have done the appropriate INTERSECTION between the person at the: atm, exiting the parking lot and the person on the first flight out of Fiftyville on the 29th. I am left with two people. I know who ...
0
votes
1answer
33 views

pset7/fiftyville - Some people do not have a passport number

I ran the following query SELECT name, passport_number FROM people ORDER BY name; This was the result name | passport_number Aaron | 9852889341 Abigail | Adam | Alan | 2884243902 Albert | ...
0
votes
1answer
30 views

pset7 - buying and selling from index results in duplicate flash's and apologies not being rendered

I passed all the check50 tests and I am working on my personal touch component, which for me is adding buying and selling to index. Everything works except: When more than one stock is sold/bought, ...
0
votes
1answer
451 views

pset7 Fifty Ville // not sure how to get the intersect of cases to find the thief

I am currently doing pset7 and I have found most of the clues of who it is but the problem is that I need to use the intersect sql function to find the common name of the thief but I am not sure how. ...
0
votes
1answer
66 views

DIFFERENCE BETWEEN TWO SQL CODES

I wrote these two codes for SQL pset7 but I'm getting different answers. Can anybody tell me the cause of the difference? SELECT COUNT(title) FROM movies WHERE id = (SELECT movie_id FROM ratings WHERE ...
0
votes
0answers
11 views

pset7 roster.py keep getting SyntaxError when printing the output

My import.py file successfully inserted the students into the database but now when I run the following code for roster.py, I keep getting syntax error from sys import argv, exit from cs50 import SQL ...
0
votes
2answers
958 views

pset7 movies sql7

I'm doing the pset8 tasks. Currently, I have some issues with sql7. In 7.sql, write a SQL query to list all movies released in 2010 and their ratings, in descending order by rating. For movies with ...
0
votes
1answer
63 views

pset 7 houses passes check 50 but shows the names 4 times

I have a really strange problem here: both import and rooster passes every check in check 50, but if I run Rooster the names on every house appear 4 times. I have no clue about why this is happening, ...
0
votes
1answer
52 views

Pset 7 Houses: Import seems to work but check50 doesn´t agree

I am confuse with this one: The program doesn´t return any error when I run it and if I go to the students table the names are there, but check50 says it imports "[]". Am I at least close to ...
0
votes
3answers
102 views

accidentally imported data multiple times (pset7 houses)

I was testing the code out and ended up running "python import.py characters.csv" multiple times. Now when I go into sqlite3 and print out the data it's repeated itself 3 times over, once ...
2
votes
0answers
51 views

Students only passing 4/6 the last two showing concatnation error but works locally somebody help

[33mTraceback (most recent call last):[0m [33mFile "roster.py", line 34, in main()[0m [33mFile "roster.py", line 27, in main print(row[0] + " " + row[1]+" "+ ...
0
votes
1answer
44 views

In students its printing all the data correctly but when I try to insert it into db its showing this funny error

File "import.py", line 58, in db.execute("INSERT INTO students (first, middle, last, house, birth) VALUES (name[0], NULL, name[1],house, birth)") File "/usr/local/lib/python3....
0
votes
0answers
46 views

Poor JOIN performance?

From my limited understanding, JOIN operations are supposed to generally be faster than nested subqueries. However, when solving the various Movies SQL problems, I'm finding queries with JOINs (...
0
votes
2answers
117 views

How can I check my number of rows on pset7 movies?

I wanted to check my queries one by one as I am doing them, my 1.sql works fine but how I find out how many rows I am getting?
0
votes
1answer
75 views

PSET7 7.sql Error

The code gives the right amount of rows but is not passing the check50 SELECT movies.title, ratings.rating FROM movies JOIN ratings ON ratings.movie_id = movies.id WHERE year = 2010 ORDER BY title ASC
0
votes
2answers
201 views

pset7 6.sql rounding problem

My code works fine but check50 give me an error because it´s not rounded the same way. :( 6.sql produces correct result expected "7.74", not "7.75" SELECT ROUND(AVG(rating), 2) ...
0
votes
1answer
27 views

7.sql CASE error

I'm getting an error where it says Error: near line 3: near "DESC": syntax error My code is SELECT title, rating FROM movies JOIN ratings ON movies.id = ratings.movie_id WHERE year = 2010 ...
0
votes
1answer
67 views

PSET 7, failing on Luna Lovegood test case even though output looks the same as expected output

Expected Output [{'first': 'Luna', 'middle': None, 'last': 'Lovegood', 'house': 'Ravenclaw', 'birth': 1981}] Actual Output: [{'first': 'Luna', 'middle': 'None', 'last': 'Lovegood', 'house': 'Ravenclaw'...
1
vote
1answer
73 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
512 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
1answer
15 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
66 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
45 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
1
vote
1answer
143 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
76 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
211 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
308 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
77 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
217 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
1answer
350 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
201 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
1answer
59 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
108 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
446 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
151 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
281 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
218 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
184 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
43 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
280 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
301 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
72 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
76 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
1answer
487 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
167 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
533 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
175 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
893 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
512 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
531 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) ...

1
2 3 4 5
15