🌍 Python · flashcards

Python To-Do List Project Flashcards

50 question-and-answer cards covering To-Do List Project as it is examined in Python. 24 of them are printed below, taken from across the deck — no signup, no paywall on the preview.

50Cards in deck
24Free preview
17Syllabus topics
~206Chars per answer
FreePrice

24 sample cards from the To-Do List Project deck

Sampled from the end of the deck, so these are different cards from the ones shown on the syllabus page.

  1. Write the core line that marks the task at position `index` as complete in a list of task dictionaries.

    `tasks[index]["done"] = True`. This sets the `done` key of the selected task dictionary to True.

  2. What Python exception is raised when you access a list position that doesn't exist, and how do you guard against it in the complete/delete features?

    `IndexError`. Guard against it by validating the index range (`0 <= index < len(tasks)`) before access, or by wrapping access in a `try/except IndexError` block.

  3. For the "Delete Task" feature, contrast `del tasks[index]`, `tasks.pop(index)`, and `tasks.remove(value)`.

    `del tasks[index]` removes by position and returns nothing. `tasks.pop(index)` removes by position and returns the removed item. `tasks.remove(value)` removes the first element equal to `value` (by value, not index).

  4. Why can deleting tasks while iterating forward over the same list with `for` cause skipped items, and what is a safe alternative?

    Removing an element shifts later elements left, so the loop's advancing index skips the item that moved into the freed slot. Safe alternatives: iterate over a copy, build a new filtered list with a comprehension, or iterate in reverse.

  5. How would you delete all completed tasks at once using a list comprehension?

    Rebuild the list keeping only incomplete tasks: `tasks = [t for t in tasks if not t["done"]]`. This creates a new list excluding every task whose `done` value is True.

  6. What is the difference between unit testing and integration testing in the context of the to-do app?

    Unit testing verifies a single function in isolation (e.g., `add_task` adds one item). Integration testing verifies that multiple components work together correctly (e.g., add then view then delete behave consistently end-to-end).

  7. Name the two most common Python testing frameworks/modules and one distinguishing feature of each.

    `unittest` (built into the standard library, class-based with `assertEqual` etc.) and `pytest` (third-party, uses plain `assert` statements and concise fixtures). pytest requires installation; unittest does not.

  8. In Python's `unittest`, what base class do test cases inherit from and what naming prefix must test methods use?

    Test cases inherit from `unittest.TestCase`, and each test method name must start with the prefix `test` (e.g., `def test_add_task(self):`) so the runner discovers it.

  9. Describe the Arrange-Act-Assert (AAA) pattern for structuring a single test case.

    Arrange: set up inputs and state (e.g., create an empty task list). Act: invoke the function under test (e.g., call `add_task`). Assert: verify the outcome (e.g., check the list length and contents are correct).

  10. Write a one-line assertion (pytest style) verifying that after adding a task, the list length is 1.

    `assert len(tasks) == 1`. After calling `add_task`, this confirms exactly one task was appended to the previously empty list.

  11. What command runs all tests with pytest, and what command runs unittest test discovery from the command line?

    pytest: simply run `pytest` (it auto-discovers `test_*.py`). unittest: run `python -m unittest` or `python -m unittest discover`.

  12. In test output, what is the difference between a test "failure" and a test "error"?

    A failure means an assertion was checked but the actual result did not match the expected value. An error means the test raised an unexpected exception before/instead of reaching the assertion (a problem in the code or the test setup).

  13. What is code coverage, and roughly what does it measure?

    Code coverage is the percentage of source code lines (or branches) executed while the test suite runs. It is measured with tools like `coverage.py` and indicates how much of the code is exercised by tests—though high coverage does not guarantee correctness.

  14. Define a "bug" and distinguish a syntax error from a logic error in Python.

    A bug is any defect causing incorrect behavior. A syntax error violates Python's grammar so the code won't even run/parse. A logic error runs without crashing but produces the wrong result because the algorithm or condition is incorrect.

  15. What is a traceback in Python and how does it help during the Fix Bugs stage?

    A traceback is the error report Python prints when an unhandled exception occurs, listing the call stack from the entry point down to the line that raised the error. It pinpoints the file, line number, and exception type to locate the bug.

  16. Name two debugging techniques: the simplest print-based one and the standard-library interactive debugger.

    Print debugging: inserting `print()` statements to inspect variable values at runtime. Interactive debugging: using `pdb` (e.g., `import pdb; pdb.set_trace()` or `breakpoint()`) to step through code, inspect state, and set breakpoints.

  17. What is a regression, and how do automated tests help prevent regressions when fixing bugs?

    A regression is when a previously working feature breaks due to a new change. Re-running the automated test suite after each fix catches regressions immediately, because broken behavior surfaces as a newly failing test.

  18. What does it mean to "package" a Python application, and which two files commonly configure modern packaging?

    Packaging means bundling code, metadata, and dependencies into a distributable, installable format. Modern configuration uses `pyproject.toml` (and historically `setup.py`/`setup.cfg`) to declare the project name, version, dependencies, and entry points.

  19. What are the two standard Python distribution formats produced for PyPI, and which is the preferred binary format?

    An sdist (source distribution, a `.tar.gz`) and a wheel (`.whl`). The wheel is the preferred built/binary format because it installs faster without a build step.

  20. What is semantic versioning (SemVer), and what do the three numbers in $MAJOR.MINOR.PATCH$ signify?

    SemVer is a versioning convention $MAJOR.MINOR.PATCH$: increment MAJOR for incompatible (breaking) API changes, MINOR for new backward-compatible features, and PATCH for backward-compatible bug fixes.

  21. Contrast packaging a console-distributable wheel (via pip) with bundling a standalone executable using a tool like PyInstaller.

    A wheel requires the end user to have Python and pip installed, then `pip install` the package. PyInstaller bundles the interpreter and dependencies into a single self-contained executable that runs on machines without Python installed.

  22. What is PyPI, and what command-line tool is conventionally used to upload a built distribution to it?

    PyPI is the Python Package Index, the public repository for Python packages. `twine` is the standard tool used to securely upload built sdists and wheels, e.g. `twine upload dist/*`.

  23. List three common channels for distributing a finished to-do app to users.

    Publishing to PyPI for `pip install`; sharing the source repository (e.g., GitHub) with install instructions; and distributing a standalone executable/installer built with a tool like PyInstaller. (Containerizing with Docker is another option.)

  24. Name three effective methods for collecting user feedback after release, and explain why feedback drives the Implement Improvements stage.

    Methods: a GitHub issue tracker, surveys/feedback forms, and in-app analytics or direct user interviews. Feedback identifies real bugs, pain points, and desired features, so improvements are prioritized by actual user needs rather than guesswork—closing the iterative development loop.

What this deck covers

The To-Do List Project deck follows the Python To-Do List Project syllabus — 7 chapters and 17 topics — so questions land on material that is genuinely examinable rather than trivia around it. That works out to roughly 7.1 cards per chapter.

Answers are written to be recallable, not just readable — averaging about 206 characters, which is long enough to carry the reasoning and short enough to say out loud.

A deck like this earns its keep on the second and third pass. Read the syllabus first so you know the shape of the subject, then use the cards to find the specific facts that have not stuck.

To-Do List Project flashcards FAQ

How many To-Do List Project flashcards are in this Python deck?

50 cards. This page previews 24 of them, sampled evenly across the deck so you can judge the difficulty before installing anything.

Are these Python flashcards free?

Yes. The preview here is free to read with no signup, and the full 50-card deck is free inside the Examius app.

What do the To-Do List Project cards cover?

They follow the Python To-Do List Project syllabus — 7 chapters and 17 topics — so the questions track what is actually examinable.

How should I use these flashcards?

Read the syllabus first so you know the shape of the subject, then drill the deck. Examius schedules each card with spaced repetition, so cards you keep missing come back sooner and ones you know drift further apart.