Multiple-choice test CLI parsing questions and saving scores.
Tick off requirements as you build to track real-time completion.
Follow this chronological guide to build the project from scratch.
Create database tables storing questions, options, and correct answers.
import sqlite3
def init_quiz_db():
with sqlite3.connect("quiz.db") as conn:
cursor = conn.cursor()
cursor.execute("""
CREATE TABLE IF NOT EXISTS questions (
id INTEGER PRIMARY KEY AUTOINCREMENT,
prompt TEXT NOT NULL,
opt_a TEXT NOT NULL,
opt_b TEXT NOT NULL,
opt_c TEXT NOT NULL,
opt_d TEXT NOT NULL,
answer TEXT NOT NULL CHECK(answer IN ('A', 'B', 'C', 'D'))
)
""")
cursor.execute("""
CREATE TABLE IF NOT EXISTS score_history (
id INTEGER PRIMARY KEY AUTOINCREMENT,
player_name TEXT NOT NULL,
score INTEGER NOT NULL,
total INTEGER NOT NULL,
date TEXT NOT NULL
)
""")
conn.commit()Real issues students hit during development and how to troubleshoot them fast.
Continue building your skills with similar projects.
Sleek weather dashboard using OpenWeather API with geolocation, 5-day forecast, and dynamic weather themes.
Personal budget tracker with transaction log, category breakdown, and Chart.js pie charts.
Movie discovery app with TMDB API, trending lists, search, and detail modals.