Questions tagged [houses]
The houses tag has no usage guidance.
20
questions
0
votes
1
answer
74
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
1
answer
58
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
3
answers
173
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
0
answers
61
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
1
answer
55
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
1
answer
70
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
1
answer
20
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
1
answer
68
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
1
answer
165
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
1
answer
79
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
1
answer
60
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
1
answer
286
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
1
answer
205
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
0
answers
176
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
1
answer
585
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
1
answer
532
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
1
answer
826
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
1
answer
89
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
2
answers
796
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
1
answer
507
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 ...