Chapter 1: Build an AI Quiz Generator with Python
- Create quizzes, validate AI output, export printable worksheets, and build a Django web app.
- Who This Book Is For
- How the Project Works
- The Project
- What You Need Before Starting
- Chapter 1 Review
Chapter 2: Setting Up the Project
- Software Requirements
- Create the Project Folder
- Create a Virtual Environment
- Add Dependencies
- Prepare the API Key
- Create a Setup Test
- Chapter 2 Review
Chapter 3: Designing the Quiz Format
- Why the Format Matters
- The First Version of the Models
- Strengthening the Model
- Why This Helps the AI Part
- Chapter 3 Review
Chapter 4: Calling the AI API
- What We Are Building in This Chapter
- Are We Just Generating JSON?
- The Role of
ai_client.py - Testing the API Call
- Chapter 4 Review
Chapter 5: Validating AI Output
- Why We Need Another Validation Layer
- Writing the
validate_quizFunction - Updating
ai_client.py - Testing the Validator with a Good Quiz
- Using the Validator in
main.py - Running the Full Flow
- What This Validator Does Not Do Yet
- Why This Chapter Matters Later
- Chapter 5 Review
Chapter 6: AI-Assisted Quiz Review
- Creating Review Models
- Why This Should Be Optional
- Chapter 6 Review
Chapter 7: Saving and Loading Quizzes
- Why Save Quizzes as JSON?
- What We Are Building in This Chapter
- The
quizzesFolder - Connecting Storage to the Main Program
- Loading a Saved Quiz from
main.py - Chapter 7 Review
Chapter 8: Playing the Quiz in the Terminal
- Building the Terminal Player
- Why Build a Terminal Player First?
- Testing the Terminal Player with a Manual Quiz
- Connecting the Terminal Player to Saved Quizzes
- Running the Full Program
- Why This Chapter Matters
- Chapter 8 Review
Chapter 9: Exporting a Printable Quiz as a PDF
- Building the PDF Exporter
- Why Use ReportLab?
- Testing the PDF Exporter
- Connecting PDF Export to
main.py - Running the Full PDF Export Flow
- Why This Chapter Matters
- Chapter 9 Review
Chapter 10: Making the Generator Smarter
- Smarter Quiz Generation
- Testing the Smarter Generator
- What This Chapter Adds
- Chapter 10 Review
Chapter 11: Turning It Into a Django Web App
- Building the Django Web App
- Why Django?
- Run the Web App
- What We Did Not Build Yet
- Why This Chapter Matters
- Chapter 11 Review
Chapter 12: Next Steps
- Planning Your Next Version
- What You Have Learned
- Final Thoughts
Appendix: Quick Reference and Next Steps
- Source Code for This Book
- A. Environment Setup Quick Reference
- B.
.envand API Configuration - C. Common Errors and Fixes
- D. Test and Validation Commands
- E. Project Structure Map
- F. Data Model Reference
- G. Prompt and AI Usage Notes
- H. Database Storage Patterns
- I. PDF Export Customization Cheatsheet
- J. Deployment Starter Checklist
- K. Glossary
- L. Next Steps Build Paths
- Final Appendix Note
