0

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

if len(argv) != 2:
    print("Usage: roster.py Gryffindor")
    exit(0)

db = SQL("sqlite:///students.db")

students_list = db.execute("SELECT first,middle,last,birth FROM students WHERE house = (?) ORDER BY last, first", argv[1])

for row in students_list:
    if row["middle"] == None:
        print(f"{row["first"]} {row["last"]}, born {row["birth"]}"
    else:
        print(f"{row["first"]} {row["middle"]} {row["last"]}, born {row["birth"]}"

The error I got was: SyntaxError: invalid syntax

You must log in to answer this question.

Browse other questions tagged .