Python fpdf Library
from fpdf import FPDF # Create a PDF pdf = FPDF() pdf.add_page() pdf.set_auto_page_break(auto=True, margin=15) # Set font pdf.set_font("Arial", size=12) # Title pdf.set_font("Arial", 'B', 16) pdf.cell(200, 10, txt="Basic Python Interview Questions for Freshers", ln=True, align='C') pdf.ln(10) # Reset font pdf.set_font("Arial", size=12) # Content qa_pairs = [ ("1. What is Python?", "Python is a high-level, interpreted programming language known for its simplicity and readability. It supports multiple programming paradigms, such as procedural, object-oriented, and functional programming."), ("2. What are the key features of Python?", "- Easy to read and write\n- Interpreted language\n- Dynamically typed\n- Extensive standard library\n- Object-oriented\n- Cross-platform"), ("3. What is the difference between a list and a tuple?", "List:\n ...