`storage.py` has been modified and staged with `git add`. It will be included in the next commit. - **"Changes not staged for commit: modified: display.py"** — `display.py` has been modified but NOT staged. It will NOT be included in the next commit unless you run `git add display.py`. - **"Untracke → Quiz: Version Control with Git
contains compiled bytecode files that Python generates automatically. They're machine-specific and regenerated every time you run the code. 2. **`venv/`** — virtual environment directories contain installed packages and Python binaries that are large, machine-specific, and reproducible from `require → Quiz: Version Control with Git
a task with a due date that can be overdue 2. **`RecurringTask`** — a task with a frequency (daily, weekly, monthly) that resets when completed 3. **`ChecklistTask`** — a task with sub-items that tracks partial progress → Chapter 15: Inheritance and Polymorphism: Building on What Exists
`def`
The keyword that tells Python "I'm defining a function." Short for *define*. - **`greet`** — The function's name. Same naming rules as variables: lowercase, underscores, descriptive. - **`(name)`** — The **parameter list**. This function expects one piece of data, which it will call `name` internall → Chapter 6: Functions: Writing Reusable Code
`False`
d) `True and True and False` → **`False`** (the last `False` makes the whole thing false) - e) `False or False or True` → **`True`** (the last `True` makes it true) - f) `not (True and False)` → `not False` → **`True`** - g) `True or False and False` → `True or (False and False)` → `True or False` → → Appendix G: Answers to Selected Exercises
`for`
Are you waiting for something to happen? → **`while`** - Iterating over a collection (string, list, etc.)? → **`for`** - Menu-driven program or input validation? → **`while`** → Key Takeaways: Repetition: Loops and Iteration
`good first issue`
Specifically chosen as approachable for new contributors - **`help wanted`** — The maintainers would welcome outside help - **`bug`** — Something is broken - **`enhancement`** — A proposed improvement - **`documentation`** — Improvements to docs (often the easiest entry point) → Case Study: The Open Source World — How to Contribute and Grow
`main`
the development branch for the next major release - **`3.12`**, **`3.13`**, etc. — maintenance branches for released versions that receive bug fixes and security patches → Case Study: How Open Source Projects Use Git
`search_tasks`
searches tasks in the current category, then recurses into every subcategory. It doesn't need to know how deep the tree goes. - **`count_all_tasks`** — counts tasks at this level, then adds the counts from all subcategories. - **`display_tree`** — prints this category, then recursively prints each s → Chapter 18: Recursion: Functions That Call Themselves
`Stack` and `Queue` classes
the ones you built in this chapter. 2. **`UndoableAction` class** — a record that stores what was done (add or delete), which task was affected, and where it was in the list (for accurate restoration). 3. **New methods on `TaskFlow`:** `undo()`, `redo()`, `schedule_task()`, `process_next()`. → Chapter 20: Intro to Data Structures: Stacks, Queues, and Beyond
`Task` is a dataclass
clean, minimal boilerplate, auto-generated `__repr__` and `__eq__` - **Observer pattern** — `TaskManager` doesn't know about console output or logging details; it just notifies observers - **Loose coupling** — you can swap `ConsoleNotifier` for an `EmailNotifier` without touching `TaskManager` - **H → Chapter 16: OOP Design: Patterns and Principles
`time.sleep(delay)`
Rate limiting. Don't hammer the server (Section 24.5). 2. **A descriptive `User-Agent` header** -- The default `python-requests/2.x` is often blocked. Transparency is both polite and practical. 3. **Error handling** -- Networks fail, servers go down. `try/except` and `timeout=10` ensure graceful fai → Chapter 24: Web Scraping and Automation
one of the four pillars from Chapter 1. Python abstracts away the details of memory management (you never manually allocate or free memory), but understanding the *concept* of names pointing to objects helps you predict how your programs will behave. This is exactly the kind of "thinking behind the → Chapter 3: Variables, Types, and Expressions: The Building Blocks
abstraction through functions
is a shift in thinking that will affect everything you write from here on. You're no longer writing one long script. You're building programs from composable, reusable, well-named pieces. → Chapter 6: Functions: Writing Reusable Code
accumulator pattern
initialize before the loop, update inside, use after — is the fundamental technique for building results from repeated operations. - `break` exits a loop early, `continue` skips to the next iteration, and `else` on a loop runs only if no `break` occurred. - **Nested loops** run the inner loop to com → Chapter 5: Repetition: Loops and Iteration
adaptive
its performance depends on how much disorder exists in the input. For each element, the inner `while` loop only runs while there are larger elements to the left that need shifting. In nearly-sorted data, most elements are already close to their correct position, so the inner loop barely executes. Th → Chapter 19 Quiz
Add a GUI
Use `tkinter` (built-in) or `PyQt` to give TaskFlow a graphical interface 2. **Add a web interface** — Use Flask or FastAPI to make TaskFlow accessible from a browser 3. **Add a database** — Replace JSON storage with SQLite (built into Python's `sqlite3` module) 4. **Add collaboration** — Let multip → Chapter 27: What's Next: Pathways in Computer Science
Adding tasks
verify a task is added with correct fields 2. **Deleting tasks** — verify deletion by index, handle invalid indices 3. **Searching tasks** — keyword search, case-insensitive matching 4. **Saving/loading JSON** — round-trip persistence (save, then load, verify data) 5. **Error handling** — invalid in → Chapter 13: Testing and Debugging: Writing Code You Can Trust
25 programming puzzles released each December. Fun, challenging, and great for practicing algorithms. - **LeetCode / HackerRank** — Coding challenges organized by difficulty and topic. Useful for interview preparation. - **Hackathons** — Timed events where you build a project (usually in 24-48 hours → Chapter 27: What's Next: Pathways in Computer Science
algorithmic intuition
the ability to look at a problem and reason about which approach will scale and which will break down. This is one of the most valuable skills in computer science, and it extends far beyond sorting and searching. In Chapter 20, you'll apply this same thinking to stacks, queues, and other abstract da → Chapter 19: Searching and Sorting: Classic Algorithms
Application Programming Interfaces. And at their core, they work exactly like the functions you wrote in this chapter: they take inputs (parameters), do some work, and return outputs (return values). → Case Study: How APIs Work — Functions All the Way Down
Artificial Intelligence and Machine Learning
How to build systems that learn from data and make decisions. We'll discuss this more in Section 27.4, but the foundations you've built — data structures, algorithms, file I/O, and working with libraries — are exactly what you need to start learning AI/ML. → Chapter 27: What's Next: Pathways in Computer Science
As a reviewer:
Critique the *code*, not the *person*. "This function is hard to follow" not "You wrote confusing code." - Ask questions instead of making demands. "Could this be simplified by...?" invites collaboration. - Acknowledge what's done well. "Nice use of `max()` here — that's cleaner than the if/else" co → Chapter 26: Software Development Lifecycle
As the author:
Don't take feedback personally. The reviewer is improving the *code*, not judging *you*. - Assume good intent. If a comment seems harsh, it's probably just tersely written — reviewers are busy. - Push back when you disagree, but explain your reasoning. "I chose X because of Y" is productive; "I like → Chapter 26: Software Development Lifecycle
Assigned as self-study (not covered in class):
Ch 1 (Welcome to CS) — Assign as pre-reading before Week 1. Students read it before the first session. - Ch 7 (Strings) — Covered briefly within Ch 8 session. Assign the chapter as reading; discuss string methods for 15 minutes before diving into lists. - Ch 12 (Modules and Packages) — Assign as rea → Syllabus: 10-Week Accelerated Quarter
assignment operator
it gives a value to a variable (`x = 5`). `==` is the **equality comparison operator** — it checks whether two values are equal and returns `True` or `False` (`x == 5`). Confusing them is one of the most common beginner bugs, and we'll revisit it in detail in this chapter. → Chapter 4: Making Decisions: Conditionals and Boolean Logic
automation as a multiplier
is this: every hour spent writing an automation script pays for itself many times over. Elena spent 8 hours building her pipeline. It saves her 200 hours per year. But more than speed, the script is *reliable*. It doesn't get tired, doesn't make transcription errors, and doesn't forget to validate t → Chapter 24: Web Scraping and Automation
Avoid circular imports
if A imports B and B imports A, restructure. 3. **Keep side effects out of module-level code** — put initialization inside functions or `__name__` guards. 4. **One responsibility per module** — if you describe it with "and," split it. 5. **Check the standard library first** — before writing a utilit → Key Takeaways: Modules, Packages, and the Python Ecosystem
a stack of frames, one per active function call. Each frame holds the function's local variables, parameters, and the return address (where to resume when the function finishes). → Chapter 18: Recursion: Functions That Call Themselves
Capstone 1: The Personal Finance Tracker
a command-line application that tracks income and expenses, categorizes transactions, generates monthly reports with statistics, and exports data to CSV. This project emphasizes data structures, file I/O, OOP design, and error handling. → Part IX: Capstones
Capstone 2: The Trivia Game Engine
a multiplayer trivia game that loads questions from files or APIs, supports categories and difficulty levels, tracks scores with a persistent leaderboard, and allows custom question creation. This project emphasizes OOP, data persistence, API integration, and user experience. → Part IX: Capstones
Capstone 3: The Data Dashboard
a command-line data analysis tool that reads real-world datasets, performs statistical analysis, generates text-based visualizations, and produces formatted reports. This project emphasizes data processing, string formatting, file I/O, modules, and regular expressions. → Part IX: Capstones
which states, which highways, what order 2. **Estimate travel time** — total driving hours, how to split across days 3. **Plan overnight stops** — find hotels or campgrounds, make reservations 4. **Budget the trip** — gas costs, food, lodging, activities 5. **Prepare the vehicle** — oil change, tire → Appendix G: Answers to Selected Exercises
Clarity
It's understandable to other humans (and to you in six months). A clever trick that saves one millisecond but takes twenty minutes to understand is usually a bad trade-off. → Chapter 17: Algorithms and Problem-Solving Strategies
decomposition, pattern recognition, abstraction, and algorithm design — is a problem-solving framework that extends far beyond programming. - Professional programmers spend most of their time reading, discussing, and debugging code — not just writing it. - CS fundamentals are durable: the concepts t → Chapter 1: Welcome to Computer Science: What Programmers Actually Do
Computer Architecture
How computers actually work at the hardware level. Binary numbers (Appendix C), memory, processors, instruction sets, and how your Python code eventually becomes electrical signals. → Chapter 27: What's Next: Pathways in Computer Science
`MILES_TO_KM`, `FEET_TO_METERS`. This follows PEP 8 convention and makes it clear these values don't change. 2. **We used f-string alignment** (`:<20` for left-align, `:>12` for right-align) to create a clean columnar layout. 3. **We used the thousands separator** (`:,`) for large numbers like feet → Case Study: Building a Unit Converter
It produces the right answer for *every* valid input, not just the ones you tested. This includes edge cases: empty lists, single elements, lists where every element is the same, negative numbers. → Chapter 17: Algorithms and Problem-Solving Strategies
Correctness:
Does the code do what the user story/requirement asks for? - Are there edge cases that aren't handled? - Could any inputs cause crashes or unexpected behavior? → Chapter 26: Software Development Lifecycle
Crypts of Pythonia
A text-based adventure game used as a running example for game design concepts. All room descriptions, items, and game mechanics are original creations. → Appendix H: Bibliography
Crypts of Pythonia (The Text Adventure)
A text-based adventure game that starts with a single if/else fork and grows into a full game with inventory management, save/load, character classes, procedural dungeon generation, and a quest system. This example makes abstract concepts tangible and fun. → How to Use This Book
if tasks have extra fields (like from the undo stack), the CSV writer silently ignores them instead of crashing. 2. **CSV import converts the `done` field** from a string (`"True"/"False"`) back to a boolean. CSV files store everything as strings — you always need to convert types when reading. 3. * → Chapter 21: Working with Data: CSV, JSON, and APIs
Custom sorting
sort tasks by priority, due date, creation date, or title using `key` functions and `lambda` 2. **Binary search** — search for a task by title in a sorted task list → Chapter 19: Searching and Sorting: Classic Algorithms
D
Daily motivational quote scraper
Fetch a random quote from `quotes.toscrape.com` and display it when the app starts, with caching so we don't re-scrape unnecessarily. 2. **Automated task report generation** -- Generate a formatted status report of all tasks and save it to a timestamped file. → Chapter 24: Web Scraping and Automation
Data Science:
Jupyter notebooks for exploratory analysis (interactive documents that mix code, text, and visualizations) - Anaconda distribution (bundles Python with hundreds of data science libraries) - Cloud-based notebooks (Google Colab, AWS SageMaker) - Database connections (SQL, NoSQL) → Case Study 2: Setting Up a Development Environment in the Real World
data transformation
There's **no state to maintain** between calls - The logic is a **pipeline** (input -> transform -> output) - Adding a class would just be wrapping a single function → Chapter 16: OOP Design: Patterns and Principles
Databases
How to store, organize, query, and manage large amounts of data efficiently. You used JSON files for persistence in Chapter 10. Databases are that idea taken to industrial scale, with query languages (SQL), indexing, transactions, and guarantees about data integrity. → Chapter 27: What's Next: Pathways in Computer Science
Decomposition
Breaking TaskFlow into modules (Ch 12): `models.py`, `storage.py`, `display.py`, `cli.py` > 2. **Pattern recognition** — Recognizing that linear search vs. binary search is a recurring pattern across problems (Ch 19) > 3. **Abstraction** — Using classes to hide internal complexity behind clean inter → Chapter 27: What's Next: Pathways in Computer Science
Deferred to Sprint 2:
Story 2 (Task Assignment) — depends on workspaces being implemented - Story 3 (Due Date Notifications) — independent but lower priority - Story 4 (Task Comments) — depends on workspaces → Example: User Stories for TaskFlow v3.0
Is the code in the right place? (Right module, right class, right function) - Are functions and classes doing one thing (Single Responsibility Principle)? - Is there unnecessary complexity? → Chapter 26: Software Development Lifecycle
dictionaries
mapping keys to values — and **sets** for membership testing and deduplication. You'll also learn how to choose the right data structure (list vs. dict vs. set vs. tuple) for a given problem. TaskFlow will upgrade from tuples to dictionaries, giving each task named fields instead of positional acces → Chapter 8: Lists and Tuples: Working with Sequences
Dictionaries and Sets
organize data by keys instead of position, enabling O(1) lookups. TaskFlow upgrades from tuples to dictionaries for named fields. → Key Takeaways: Lists and Tuples
Dictionary.
Need to check membership (is X in the collection)? **Set.** - Need ordered items that you will modify? **List.** - Need ordered items that should not change? **Tuple.** - Need key-value pairs with ordering? **Dictionary** (preserves insertion order since 3.7). → Common Student Struggles and Interventions
⭐ Foundational (5-10 min each) - ⭐⭐ Intermediate (10-20 min each) - ⭐⭐⭐ Challenging (20-40 min each) - ⭐⭐⭐⭐ Advanced/Research (40+ min each) → Exercises: Welcome to Computer Science
Divide and Conquer
The closest-pair problem has a famous O(n log n) divide-and-conquer solution. Brute force would be O(n²). 2. **Brute Force** — With only 8 items, there are 2⁸ = 256 subsets. Brute force checks them all easily. (For 80 items, you'd need dynamic programming — a topic for CS2.) 3. **Greedy** — Scheduli → Chapter 17: Algorithms and Problem-Solving Strategies
it tells the user what went wrong 2. **Doesn't lose data** — it saves progress before failing 3. **Gives actionable feedback** — "File 'grades.csv' not found in /home/user/data/" is useful; a raw traceback is not (for most users) 4. **Fails gracefully** — when it truly can't continue, it cleans up a → Chapter 11: Error Handling: When Things Go Wrong (and They Will)
Is it widely used? 2. **Maintenance** — When was the last update? 3. **Source code** — Can you read it? Is it on GitHub? 4. **Documentation** — Is it clear and current? 5. **License** — Is it compatible with your project? 6. **Dependencies** — How many does it pull in? → Key Takeaways: Libraries and Virtual Environments
Dr. Anika Patel
Biology researcher at a university, processing DNA sequence data. Her scenarios illustrate bioinformatics applications of Python. Dr. Patel's workflows are inspired by common bioinformatics tasks described in Cock et al.'s Biopython documentation and computational biology textbooks, but all specific → Appendix H: Bibliography
Dr. Patel's DNA Pipeline (Dr. Anika Patel)
A biology researcher processing thousands of DNA sequence files. From counting nucleotides to pattern matching to batch processing to querying bioinformatics APIs. Dr. Patel's story shows that CS skills amplify domain expertise in any field. → How to Use This Book
E
Efficiency
It doesn't waste time or memory. The key insight of this chapter is that efficiency isn't about absolute speed ("it takes 0.3 seconds") — it's about *how running time grows* as input grows. → Chapter 17: Algorithms and Problem-Solving Strategies
Elena Vasquez
Data analyst at a nonprofit organization. Appears throughout the textbook as the anchor example for real-world data processing, automation, and professional development. Elena's scenarios are composites of common data analyst workflows described in industry blogs and professional development resourc → Appendix H: Bibliography
Elena's Nonprofit Report (Elena Vasquez)
A data analyst at a nonprofit who spends four hours every week manually assembling a report from three different spreadsheets. Over the course of the book, she automates the entire pipeline. Elena's story demonstrates why programming matters outside of tech: automation frees people to do meaningful → How to Use This Book
encapsulation
hiding internal state behind a public interface. The `Stack` class wraps a list but only exposes stack operations. Users don't need to know (or care) that a list is used internally. They interact with a *concept*, not an implementation. → Chapter 20: Intro to Data Structures: Stacks, Queues, and Beyond
Error handling:
Wrap `requests.get()` in `try/except` to handle network errors. - Use `response.raise_for_status()` to catch HTTP errors (404, 500, etc.). - If a page fails, log the error and continue to the next page rather than crashing. - Validate extracted data (e.g., prices should be numeric). → Quiz: Web Scraping and Automation
Likely violates the competitor's Terms of Service. - Could constitute unfair business practices or even be illegal under some jurisdictions' computer fraud laws. - The aggressive rate could degrade the competitor's site performance, affecting their legitimate customers. - Automated price undercuttin → Quiz: Web Scraping and Automation
ethics of scraping
`robots.txt`, Terms of Service, and the question of when scraping is responsible. You explored **automation beyond scraping** -- file organization, batch renaming, and report generation. You learned to **schedule scripts** with `cron`, Task Scheduler, and the `schedule` library. And you saw the **pi → Chapter 24: Web Scraping and Automation
Exception types to catch:
`ValueError` — for failed numeric conversions - `IndexError` — for rows with fewer fields than expected → Quiz: Error Handling
Use `python3 my_script.py` instead of `./my_script.py`. - If you must run it directly: `chmod +x my_script.py` and add `#!/usr/bin/env python3` as the first line. → Appendix B: Environment Setup Guide
Focused
tests one behavior, not five 2. **Independent** — doesn't depend on other tests or shared state 3. **Readable** — the function name describes what's being tested 4. **Deterministic** — produces the same result every time 5. **Fast** — runs in milliseconds, not seconds → Chapter 13: Testing and Debugging: Writing Code You Can Trust
Follow the style guide
practitioner tone, second person, encouraging but direct 3. **Respect the citation honesty system:** - Tier 1: Only for sources you can verify exist - Tier 2: Attributed but unverified claims - Tier 3: Clearly labeled illustrative examples 4. **Maintain voice consistency** with the existing chapters → Contributing to Introduction to Computer Science with Python
Forgetting `r` prefix
`"\b"` is a backspace; `r"\b"` is a word boundary 2. **Using `re.match()` when you mean `re.search()`** — `match()` only checks the start 3. **Greedy matching between delimiters** — `"<.*>"` matches too much; use `"<.*?>"` 4. **Overly complex regex** — if a colleague can't read it in 30 seconds, sim → Key Takeaways: Regular Expressions
Forgetting `return`
function prints instead of returning, caller gets `None` 2. **Mutable default argument** — `def f(items=[])` shares the list across calls; use `None` instead 3. **Scope confusion** — assigning to a name inside a function creates a local, potentially shadowing a global → Key Takeaways: Functions — Writing Reusable Code
Forgetting `self`
every method needs it as the first parameter, every attribute access uses `self.` 2. **Mutable class attributes** — lists/dicts at the class level are shared between all instances; use `__init__` instead 3. **God classes** — split large classes into focused ones, each with a single responsibility → Key Takeaways: Object-Oriented Programming — Thinking in Objects
Forgetting `super().__init__()`
parent attributes never get set, causing `AttributeError` later 2. **Using inheritance when composition is appropriate** — a Stack is not a list 3. **Deep hierarchies** — keep to 2-3 levels; deeper trees are hard to debug 4. **Breaking Liskov** — subclasses should work everywhere their parent works → Key Takeaways: Inheritance and Polymorphism
function
but the function lives on a server thousands of miles away. When you log into a website with your Google account, that website calls a **function** on Google's servers. When you ask a chatbot a question, the chatbot calls a **function** in an AI system. → Case Study: How APIs Work — Functions All the Way Down
what kind of conversion, and what value? 2. **Convert the value** — apply the right formula 3. **Display the result** — formatted cleanly → Case Study: Building a Unit Converter
student project that grows from simple to sophisticated 2. **Elena Vasquez** — nonprofit data analyst automating reports 3. **Crypts of Pythonia** — text adventure game 4. **Dr. Anika Patel** — biology researcher processing DNA data → Key Takeaways: Welcome to Computer Science
Use the most specific exception type (`ValueError`, not `Exception`) - Include the actual problematic value in the message - Raise early (in the function), catch late (in the caller) → Key Takeaways: Error Handling
She checks the newspaper's `robots.txt` — the archive section is allowed. - She reads the Terms of Service — academic research using publicly visible data is permitted. - She sets `time.sleep(3)` between requests (3 seconds — conservative). - She includes a User-Agent header: `"Maya-ClimateResearch/ → Case Study: Ethical Web Scraping — When It's OK and When It Crosses the Line
His approach:
He scrapes three pages per day (one per store) — minimal server impact. - He checks each store's `robots.txt` — product pages are allowed. - He doesn't redistribute the price data. - He uses the data only for his own purchasing decisions. → Case Study: Ethical Web Scraping — When It's OK and When It Crosses the Line
How it works:
Scan left to right. - `(` → push onto the stack (we'll need to match it later). - `)` → pop the stack (we're matching the most recent `(`). - If we try to pop an empty stack, there's an unmatched `)`. - After scanning, if the stack isn't empty, there are unmatched `(`s. → Case Study 1: Building a Bracket Matcher
Solve problems on LeetCode, HackerRank, or Project Euler - Implement a data structure from scratch (linked list, binary tree, hash table) - Build a pathfinding visualizer → Chapter 27: What's Next: Pathways in Computer Science
If you loved data and automation (Ch 7-10, 21-24):
Build a budget tracker that reads your bank's CSV exports - Create a script that monitors a website for changes and sends you alerts - Automate something tedious in your daily life (file organization, email filtering, data cleanup) → Chapter 27: What's Next: Pathways in Computer Science
Explain what computer science is and why it's more than "learning to code" - Break down problems using the four pillars of computational thinking - Identify real career paths in CS beyond the Silicon Valley stereotype - Understand why fundamentals matter even when AI can write code for you → Chapter 1: Welcome to Computer Science: What Programmers Actually Do
if the user selects a category/difficulty combination with fewer questions than rounds requested, inform them and adjust. *(Chapters 4, 11)* - The game must **never crash** from user input. Invalid menu selections, non-numeric input, and empty strings should all produce helpful messages. *(Chapter 1 → Capstone Project 2: The Trivia Game Engine
Interpreting your results:
**Mostly 3s and 4s:** You've built a strong foundation. You're ready for CS2, personal projects, and entry-level internships. The areas where you scored 2 are worth revisiting before moving on. - **Mix of 2s and 3s:** You've learned a lot but some concepts haven't fully solidified. That's normal — c → Chapter 27: What's Next: Pathways in Computer Science
Issue
someone reports a bug or proposes a feature 2. **Discussion** — the community discusses whether and how to address it 3. **Fork + Branch** — a contributor creates a branch to work on the solution 4. **Pull Request** — the work is submitted for review 5. **Review** — maintainers examine the code, tes → Case Study: How Open Source Projects Use Git
Iteration
the act of repeating a process — is one of those ideas that fundamentally changes how you think about problems. Before you understand loops, you think about tasks in terms of "how long would this take me?" After you understand loops, you think in terms of "can I describe the pattern of what needs to → Chapter 5: Repetition: Loops and Iteration
K
Key concepts:
`open()` creates a file object; the mode (`"r"`, `"w"`, `"a"`) determines what you can do with it. - Context managers (`with`) guarantee files are closed, even when errors occur. - Process large files line by line to keep memory usage constant. - `pathlib.Path` provides cross-platform path handling → Chapter 10: File Input and Output: Persistent Data
Key ideas:
A **stack** supports `push`, `pop`, and `peek`. It's used for undo systems, bracket matching, backtracking, and expression evaluation. Implement it with a Python list using `append()` and `pop()` for O(1) operations. - A **queue** supports `enqueue`, `dequeue`, and `front`. It's used for task schedu → Chapter 20: Intro to Data Structures: Stacks, Queues, and Beyond
Key patterns used:
**EAFP for file operations:** Try to open/read, catch specific exceptions - **Retry loops for input:** Keep asking until the user provides valid input - **Custom exceptions:** Domain-specific error classes (though in this simple version, they're defined for future use as TaskFlow grows) - **Top-leve → Chapter 11: Error Handling: When Things Go Wrong (and They Will)
mutable and immutable sequences. The indexing and slicing you learned here work identically on lists. The key new concept: mutability — what happens when sequences *can* be changed in place (the opposite of string immutability). → Key Takeaways: Strings — Text Processing and Manipulation
the programming construct that lets you say "do this thing repeatedly" without writing the same code over and over. Loops are where programming goes from "neat parlor trick" to "genuinely powerful tool." Once you can tell a computer to repeat a task, you can process datasets that would take a human → Chapter 5: Repetition: Loops and Iteration
leads to `RecursionError` 2. **Base case that's never reached** -- recursive step doesn't make the problem smaller 3. **Tree recursion without memoization** -- exponential time (Fibonacci is the classic example) 4. **Using recursion when iteration is simpler** -- e.g., summing 1 to n → Key Takeaways: Recursion
Missing entries that should be added:
`__pycache__/` — compiled bytecode directories - `*.py[cod]` — compiled Python files (`.pyc`, `.pyo`, `.pyd`) - `.pytest_cache/` — if using pytest - `.coverage` and `htmlcov/` — if using coverage testing - IDE settings like `.vscode/` or `.idea/` - OS files like `.DS_Store` or `Thumbs.db` → Quiz: Version Control with Git
splitting a growing program like TaskFlow into separate files that can be imported and reused. Then in Chapter 13, you'll combine error handling with **testing and debugging** to write code that you can *prove* works correctly. → Chapter 11: Error Handling: When Things Go Wrong (and They Will)
the algorithm actually used by most modern operating systems. A process that uses its entire quantum gets moved to a lower-priority queue, while a process that finishes early stays at a higher priority. This automatically rewards interactive processes. → Case Study 2: How Operating Systems Use Queues
Search for "mutmut Python mutation testing" (Tier 2) Mutation testing works by introducing small changes (mutations) into your code and checking whether your tests catch them. If a mutation doesn't cause any test to fail, your tests have a gap. It's a way to test your tests. → Further Reading: Testing and Debugging
N
name mangling
Python internally renames it to `_BankAccount__balance`. You *can* still access it via `account._BankAccount__balance`, but the ugly name screams "you shouldn't be doing this." The purpose is to prevent *accidental* access, not to enforce a security boundary. → Chapter 14: Object-Oriented Programming: Thinking in Objects
name tags
when `age` is reassigned, the old value isn't "changed"; the name `age` is pointed to a new integer object. This is why `age` reflects the latest input each time the condition is checked. → Chapter 5: Repetition: Loops and Iteration
How computers communicate with each other. You used APIs and HTTP requests in Chapter 21. Networking courses explain the protocols underneath: TCP/IP, DNS, routing, sockets, and how the internet actually works. → Chapter 27: What's Next: Pathways in Computer Science
No menu or choices
the user can't pick which conversion to run. (Chapter 4: conditionals) - **No looping** — the program runs once and exits. (Chapter 5: loops) - **No error handling** — entering "abc" instead of a number crashes the program. (Chapter 11: error handling) - **No reverse conversions** — we hardcoded the → Case Study: Building a Unit Converter
No test isolation
if the second assertion fails, the third and fourth never run. With separate test functions, all tests run independently. → Quiz: Testing and Debugging
Not correct
it's missing a base case. Without one, it will recurse forever (and raise `RecursionError`). Even if it had a base case, calling `total` with a negative number or zero would also be problematic. → Quiz: Recursion
every existing element must shift right by one position. - c) **O(1)** average — hash table lookup. - d) **O(n)** worst case — must scan through the entire list. → Quiz: Algorithms and Problem-Solving Strategies
Pros: Each student naturally bundles name, grades, and major. Methods like `calculate_gpa()` belong with the data. If you process thousands of students, each object manages its own state cleanly. → Quiz: Object-Oriented Programming — Thinking in Objects
Operating Systems
How computers manage their resources: memory, processors, files, and processes. You've been using an operating system every time you ran a Python script. An OS course explains the machinery underneath — scheduling, virtual memory, file systems, and concurrency. → Chapter 27: What's Next: Pathways in Computer Science
Build things you care about using concepts from the course 2. **Open source** — Start small (documentation, tests, error messages) and grow 3. **GitHub profile** — Pin quality projects with clear READMEs; consistency over quantity 4. **Competitions** — Advent of Code, LeetCode, hackathons, Project E → Key Takeaways: What's Next — Pathways in Computer Science
Pros: Calculating class averages and producing a report are one-time operations on a collection. A function like `generate_report(students)` is simpler than a `ReportGenerator` class for a one-off task. → Quiz: Object-Oriented Programming — Thinking in Objects
The annual Python conference is welcoming to beginners and often has student pricing or scholarships. - **Local hackathons** — Check your university, local tech companies, or MLH (Major League Hacking) for events. - **Study groups** — Form one with classmates. Working through CS2 together is dramati → Chapter 27: What's Next: Pathways in Computer Science
open source since 1991, developed by a global community of thousands - **VS Code** — Microsoft's editor, open-sourced in 2015, with over 30,000 community-contributed extensions - **Git** — created by Linus Torvalds in 2005, maintained by a global volunteer community - **pytest** — the testing framew → Case Study: The Open Source World — How to Contribute and Grow
Python Documentation
[docs.python.org/3/](https://docs.python.org/3/) The official documentation. Learn to read it — it's one of the best language references in existence. Start with the Tutorial and Library Reference sections. → Appendix H: Bibliography
three well-documented projects beat thirty bare repositories - **Your TaskFlow project** — you built this across 27 chapters. Clean it up, write a thorough README, and pin it. It demonstrates functions, OOP, file I/O, testing, error handling, and Git — exactly the skills employers look for in a CS1 → Chapter 27: What's Next: Pathways in Computer Science
Queue
tickets should be processed in FIFO order to be fair; the first customer to submit should be served first. → Quiz: Stacks, Queues, and Beyond
Quotes to Scrape
http://quotes.toscrape.com (used in this chapter) - **Books to Scrape** — http://books.toscrape.com - **HTTPBin** — https://httpbin.org (for testing HTTP requests) - **The Scrapinghub Blog's list of practice sites** — search "web scraping sandbox" for additional options → Further Reading: Web Scraping and Automation
Python traceback tells you the file, line, and exception type 2. **Print debugging** — add `print()` calls to see intermediate values 3. **Rubber duck debugging** — explain the code line by line out loud 4. **Binary search debugging** — check the midpoint, narrow to the half that's broken 5. **VS Co → Key Takeaways: Testing and Debugging
Readability:
Are names clear and descriptive? - Would someone unfamiliar with this code understand it? - Are there comments where the code isn't self-explanatory? → Chapter 26: Software Development Lifecycle
Reading code is as important as writing it
most professional developers spend more time reading code than writing it 3. **Errors are not failures, they are information** — debugging is the skill, not the obstacle 4. **Many ways to solve every problem** — learning to evaluate trade-offs separates beginners from professionals 5. **The tools yo → Introduction to Computer Science with Python: Computational Thinking for the AI Era
Real Python
[realpython.com](https://realpython.com/) High-quality Python tutorials, articles, and video courses. Covers everything from beginner to advanced topics. Many articles are freely accessible. → Appendix H: Bibliography
Real-world examples:
Server log files (Apache, Nginx) - Configuration files in older Unix tools - README files, changelogs - Output from command-line tools → Case Study: Data Formats in the Wild
the keyword search feature should support regex patterns (e.g., searching for `\d{3}-\d{4}` to find phone number patterns). *(Chapter 22)* - Use regex for **date detection** during column type classification (recognize patterns like `2026-03-14`, `03/14/2026`, `March 14, 2026`). *(Chapter 22)* - Use → Capstone Project 3: The Data Dashboard
regression
something that used to work stopped working because of an unrelated change. How does a test suite protect against regressions? What would have happened without one? → Case Study: The Test That Saved a Launch
regex for short. A regex is a mini-language for describing text patterns. Instead of saying "find the exact string `555-867-5309`," you say "find three digits, then a separator, then three digits, then a separator, then four digits." The regex engine handles the rest. → Chapter 22: Regular Expressions: Pattern Matching Power
relative import
it says "import from `calculations.py` which is in the same directory as me." This is different from an **absolute import** like `from grading.calculations import ...`, which uses the full package path. → Chapter 12: Modules, Packages, and the Python Ecosystem
Check `robots.txt` before starting. - Add `time.sleep(1)` or more between page requests. - Use a descriptive `User-Agent` header. - Limit the total number of requests per session. - Consider if the site has an API instead. → Quiz: Web Scraping and Automation
Rule of thumb:
If your data looks like a spreadsheet (rows and columns, all the same fields), use CSV. - If your data is nested, has varying fields per record, or needs to round-trip through a web API, use JSON. - If your data is just human-readable notes or logs, plain text is fine. → Chapter 10: File Input and Output: Persistent Data
S
safety
when you pass a string to a function, you can be certain the function cannot alter your original string, eliminating an entire category of bugs. Other valid benefits include: strings can be used as dictionary keys (hashability), memory optimization through string interning, and thread safety. → Quiz: Strings — Text Processing and Manipulation
Scoring:
**5/5:** You are completely ready. Math will not be a barrier. - **3-4/5:** You are fine. Brush up on order of operations (PEMDAS) and basic algebra if you want extra confidence. Appendix C covers the math foundations you will need. - **0-2/5:** Consider reviewing basic algebra before or alongside C → Prerequisites and Self-Assessment
Story 1 (Team Workspaces) — core feature, everything else depends on it - Story 5 (Task Templates) — small, independent, quick win for user value → Example: User Stories for TaskFlow v3.0
sequence
and in Python, many things are sequences. We'll explore lists and tuples fully in Chapter 8, but here's a preview of how `for` works with them. → Chapter 5: Repetition: Loops and Iteration
CS professionals featured in the career profiles of Chapter 1. Composite characters representing common career paths in software engineering, data science, and cybersecurity. → Appendix H: Bibliography
Software Engineering
How to build large software systems in teams. Chapter 26 introduced you to the software development lifecycle. A full software engineering course goes deeper into requirements analysis, architecture, design patterns, continuous integration, and project management. → Chapter 27: What's Next: Pathways in Computer Science
special methods
also called **dunder methods** (short for "double underscore") — that let your objects integrate with Python's built-in operations. You've already seen `__init__`. Here are the most important ones. → Chapter 14: Object-Oriented Programming: Thinking in Objects
browser tabs follow LIFO: you typically close the most recently opened tab first, and "close" undoes the last "open." → Quiz: Stacks, Queues, and Beyond
Universal — every tool, every language, every OS can read it - Human-readable with no special tools - Append-friendly (great for logs) → Case Study: Data Formats in the Wild
Python's text processing powerhouse. You'll learn to slice, search, transform, and format text data. The string methods you learn there are among the most frequently used tools in real-world Python code. And now that you understand functions, you'll be able to build string-processing *functions* tha → Chapter 6: Functions: Writing Reusable Code
Strings are immutable
you can't change them in place, only create new ones - **String methods** like `split()`, `join()`, `strip()`, `replace()`, `find()`, `upper()`, and `lower()` are your daily tools for text processing - **Inspection methods** like `isdigit()`, `isalpha()`, and `isalnum()` validate input - **f-string → Chapter 7: Strings: Text Processing and Manipulation
Python catches the missing `)` before running. > 2. **Runtime error** — `IndexError` occurs when the list index is out of range. > 3. **Logic error** — the program runs fine but the tip is 10x too small. No exception is raised. > → Chapter 11: Error Handling: When Things Go Wrong (and They Will)
system Python
the Python installation that ships with your operating system (or the one you installed in Chapter 2). Every project on your computer shares that single installation, including every package you've ever installed. → Chapter 23: Libraries and Virtual Environments
Systems/DevOps:
Multiple terminal sessions (often using a tool called tmux) - SSH connections to remote servers - Infrastructure-as-code tools (Terraform, Ansible) - Monitoring dashboards - Heavy use of scripting (Bash, Python) → Case Study 2: Setting Up a Development Environment in the Real World
The progressive project built across all 27 chapters. A command-line task manager that evolves from a simple to-do list to a full-featured productivity tool. Original design. → Appendix H: Bibliography
Technical problems:
30-second intervals is extremely aggressive. The friend's IP will likely get blocked quickly. Even 1-minute intervals are considered fast for most sites. - No mention of `robots.txt` compliance. - Price pages often require JavaScript rendering, so `requests + Beautiful Soup` may not work — might nee → Quiz: Web Scraping and Automation
these tests verify that Python's `+`, `upper()`, `append()`, and dict indexing work. You should be testing *your* functions, not the language itself. → Quiz: Testing and Debugging
Tests multiple unrelated things in one function
if the addition assertion fails, you don't know if the string, list, or dict tests would also fail. Each test should verify one behavior. → Quiz: Testing and Debugging
Three of the fifteen companies' Terms of Service state: "You may not use automated means to access this site." - Two companies send her cease-and-desist letters asking her to stop scraping their listings. - One company offers her an API with a commercial license for $500/month. → Case Study: Ethical Web Scraping — When It's OK and When It Crosses the Line
The Grade Calculator
Your first real program. Starts as simple averaging and evolves into a weighted grade system with letter grades, GPA computation, CSV export, and eventually an OOP refactor. This example appears in nearly every chapter and grounds abstract concepts in something immediately relatable. → How to Use This Book
The problems multiply:
The platform's `robots.txt` explicitly disallows scraping user profiles. - The Terms of Service prohibit automated data collection. - The scraped data includes personal information — even though profiles are "public," users didn't consent to bulk collection and aggregation. - Derek's database makes → Case Study: Ethical Web Scraping — When It's OK and When It Crosses the Line
every chapter, every example, every exercise - **Python's official documentation** — `docs.python.org` is a professional resource, not a cheat sheet - **Your own previous code** — including TaskFlow and chapter exercises - **Stack Overflow and similar sites** — for specific syntax questions ("how do → Capstone Rubric: Detailed Assessment Criteria
traceback
a detailed report showing exactly what went wrong and where. New programmers often find tracebacks intimidating, but they're actually Python trying to help you. Learning to read them is one of the highest-leverage debugging skills you can develop. → Chapter 11: Error Handling: When Things Go Wrong (and They Will)
change the password or rotate the API key 2. Remove the file from tracking: ```bash git rm --cached secrets.env echo "secrets.env" >> .gitignore git add .gitignore git commit -m "Remove secrets.env from tracking" git push ``` 3. For truly sensitive data, look into `git filter-branch` or the `BFG Rep → Case Study: The Git Disaster Recovery Guide
The problem is straightforward repetition or accumulation - Deep recursion would exceed Python's stack limit - Performance is critical and the recursive overhead matters → Key Takeaways: Recursion
Use OOP when:
You're modeling "things" with identity, state, and behavior (nouns: Student, Task, Room) - Multiple related data items belong together - You need multiple instances of the same concept - State changes over time and needs tracking → Key Takeaways: Object-Oriented Programming — Thinking in Objects
Use recursion when:
The data is naturally recursive (directories, trees, nested structures) - The problem decomposes into smaller self-similar sub-problems - A recursive solution is significantly clearer than an iterative one → Key Takeaways: Recursion
`test_everything` gives no information about what's being verified. Good names describe the specific behavior: `test_add_returns_sum`, `test_upper_converts_lowercase`. → Quiz: Testing and Debugging
Validate every field
reject empty questions, reject questions with fewer than 2 choices, ensure the correct answer matches one of the choices. *(Chapter 11)* - **Save new questions** to the question bank file immediately. *(Chapter 10)* → Capstone Project 2: The Trivia Game Engine
version control with Git
how to track your code's history, experiment fearlessly on branches, and collaborate with other developers. You'll initialize a Git repository for TaskFlow and learn the workflow that powers open-source development worldwide. → Chapter 24: Web Scraping and Automation
virtual environment
an isolated Python installation with its own set of installed packages. This prevents "dependency hell," where Project A needs version 1.0 of a library and Project B needs version 2.0 of the same library. Virtual environments keep each project's dependencies separate. You'll learn about virtual envi → Case Study 2: Setting Up a Development Environment in the Real World
virtual environments
isolated Python installations for each project. In real work, you'll create a virtual environment for every project to avoid version conflicts between different projects' dependencies. For now, `pip install` in your global Python installation is fine for learning. → Chapter 12: Modules, Packages, and the Python Ecosystem
**Lines 1-5:** Print a visual banner with a horizontal rule made from `=` signs. - **Lines 7-9:** Three `input()` calls, each storing the user's response in a variable. The variable names (`name`, `city`, `language`) describe what they hold — a habit you should build from day one. - **Lines 11-14:** → Chapter 2: Getting Started: Python, VS Code, and Your First Program
We added context
the reference temperatures help the user interpret the result. Is 22°C hot or cold? The reference table makes it clear. → Case Study: Building a Unit Converter
VS Code with extensions for HTML, CSS, JavaScript - Node.js runtime alongside Python - Browser developer tools for debugging - Docker for running databases and services locally - Framework-specific tools (Django, Flask, FastAPI) → Case Study 2: Setting Up a Development Environment in the Real World
Variables to store data (`user_name`, `task_name`, `task_created`) - Type awareness — `datetime.now()` returns a datetime object, which we convert to a formatted string - f-strings for clean output formatting - String repetition (`"=" * 40`) for visual structure → Chapter 3: Variables, Types, and Expressions: The Building Blocks
Where it could become problematic:
If he scaled it to check prices every 30 seconds — that's aggressive and could trigger IP blocks. - If he built a public price comparison website with the data — he'd be redistributing commercial data, potentially violating Terms of Service. - If one of the stores' Terms of Service explicitly prohib → Case Study: Ethical Web Scraping — When It's OK and When It Crosses the Line
widget
a visual element that can be drawn on screen. Buttons, text fields, labels, checkboxes, panels — they're all widgets. And they all share common properties: a position, a size, visibility, and the ability to draw themselves. → Case Study: How GUI Frameworks Use Inheritance
your actual files on disk, in the state you can see and edit 2. **Staging Area** — a selection of changes you've chosen to include in the next commit 3. **Repository** — the permanent history of all commits (stored in `.git`) → Chapter 25: Version Control with Git: Collaborating Like a Professional