pricelist

master
Dr. Sascha Woitschetzki 2024-03-11 09:21:06 +07:00
parent a0f114ac0e
commit 9ebe4839c0
3 changed files with 13 additions and 1 deletions

Binary file not shown.

@ -0,0 +1,11 @@
from cs50 import sql
db = sql.SQL("sqlite:///pricelist.db")
partnumber = input("Partnumber?: ")
count = db.execute("SELECT COUNT(*) FROM pricelist WHERE Partnumber = ?;", partnumber)
rows = db.execute("SELECT * FROM pricelist WHERE Partnumber = ?;", partnumber)
for row in rows:
print(f"{row['Partnumber']} | {row['Option']} | {row['Description']}")
print(f"Found {count} products.")

@ -4,5 +4,6 @@ db = sql.SQL("sqlite:///shows.db")
title = input("Title?: ")
rows = db.execute("SELECT * FROM shows WHERE title = ? LIMIT 10", title)
print("title | year | episodes")
for row in rows:
print(row)
print(f"{row['title']} | {row['year']} | {row['episodes']}")