A structured refresher on Python and SQLite3 fundamentals, designed to shake off the rust and build a foundation for creating an SQL Learning Tool for High School Computer Science learners.
This repository contains three progressive warm-up exercises that transition from pure Python logic to database integration, culminating in a GUI foundation. These tasks directly inform the architecture of an interactive SQL practice tool for students.
- Python 3.x
- SQLite3 (comes bundled with Python)
- CustomTkinter (for task 3)
pip install customtkinterThree escalating challenges that build each other, moving from in-memory data structures to presistent storage then adding a graphical intergace.
Goal: Demostrate proficiency with data structures and control flow without database complexity.
The Task: Build a student management system using a list of dictionaries.
Requirements:
- Function to add a student (name and grade)
- Function to display all students
- Function to filter and display students with grades above 50
Key Concepts:
- Functions and scope
- Lists and dictionary manipulation
- Conditionals and loops
This task matters because it isolates Python fundamentals before intrducing database complexity. If your logic breaks here, it'll break later-fix it fist!
Goal: Re-establish connection to SQLite3 and understand basic CRUD operations.
The Task: Migrate the Task 1 logic to use a persistent school.db database file.
Requirements:
- Create a
studentstable with appropriate schema - Insert at least 3 rows of data programatically
- Execute a
SELECTquery and display results to console
Critical commands to remember:
db_connection.commit() # Otherwise your data will just into 'limbo'
my_cursor.execute(<sql>) # Your SQL interfaceThis task matters because it bridges the gap between temporary Python data structures and persistent SQL storage. Many beginners forget commmit() - you'll remember it now!
Goal: Prove that modern Python GUIs are approachable and powerful.
The Task: Create a responsive window with user and dynamic feedback.
Requirements:
- Entry box for user input
- Button that triggers an action
- Label that updates with the entered text
- Use CustomTkinter (not standard Tkinter)
Why CustomTkinter?
- Modern, clean appearance out of the box
- Class-based architecture encourages organized code
- Direct foundation for the SQL tool (SQL input box + run button)
This task matters because it is the exact interaction pattern my SQL Learning Tool will use - student types SQL --> click button --> sees results
Python-SQL-Practice-Prep/
|-- ThePurePythonLogic.py # List of dictionarie implemention
|-- TheSQLiteHandshake.py # Database integration
|-- gui_skeleton.py # CustomTkinter interface
|-- school.db # Generated SQLite database (Task 2)
- Defensive Programming (The Safety Net)
- Try/Exept Blocks: I learnt how to prevent my application from craching when a user makes a mistake. By wrapping risky code (like
int(input())) in atryblock, I can catch errors likeValueErrorand provide helpful feedback instead of a crash. - Specific Error Catching: I realized it's better to catch a specific error than a general one, so I don't accidetally hide bigger bugs in my code.
- Database Security (The Gold Standard)
- SQL Injection Prevention: I learnt why String Concatenation (f-strings) is dangerous for database queries.
- Parameterized Queries: I implemented the
?placeholder system. This sanitizes user input, ensuring that a student's practice query doesn't accidentally delete the entire database.
- Modern GUI Architecture
- CustomTkinter vs Standard Tkinter: I moved from the older. "blocky" look of standard Tkinter to a modern, themed interface.
- The Grid System: I mastered the Graph Paper approach to layout -- using rows, columns and
stickyproperties to make sure the UI looks professional and stays organized when resized. - WIdget Control: I learned how to get data from a
CTkTextboxusing specific coordinated ("1.0", "end-1c") and how to confugure labels and boxes to update the user user on the fly.
MIT - Use freely for personal learning or classroom instruction.