Questions tagged [houses]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
10 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
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
96 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
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'...
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
65 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. ...
1
vote
1answer
142 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
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
280 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
183 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
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
505 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
vote
1answer
816 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"...
0
votes
1answer
88 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
787 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
492 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 ...