Skip to main content
6 day streak
Skip to lesson
CareerPetalPython field guide
Loading progress...
Course contents
PYTHON FIELD GUIDE

Course contents 72 topics / 15 parts

Full course overviewOriginal coding practice / separate server checks

Essentials first, then internals and engineering trade-offs.

LESSON 70 / PROJECTS AND ASSESSMENTS

Project: a bounded concurrent pipeline

Build a small asynchronous producer/consumer pipeline with bounded pending work, explicit completion acknowledgments and structured task ownership. Make failure and shutdown part of the design rather than only processing the happy path.

AdvancedProject 40 min core+25 min deep divePython 3.11+ / 2026-10-27
Saved work unavailable

Save privately stores your edited code, notes and current section. Runs and public checks are not saved as verified scores.

Before you start

Learners ready to reason about Python internals, resource boundaries and the listed prerequisites.

Explore the connected curriculum and preparation map

Lesson content version 2026-10-27. Suggested core budget: 40 minutes; optional deep dive: 25 more minutes. These are reading/practice estimates, not a timed test.

Suggested preparation and repair routes

If an example or checkpoint feels unclear, revisit the relevant foundation and return. These links do not lock the lesson or claim you passed a prerequisite.

Actual runtime and local-lab boundaries

Browser Python 3.13: fresh isolated worker, 4-second execution, 16 KiB output, 256 MiB Python heap; no outbound network, host processes, interactive input or package installation.

A real threaded/process pipeline needs a local or separately approved lab. Browser models do not certify host concurrency.

Public checks, revealed answers and project self-checks are learning feedback, not verified mastery or problem acceptance. Saving code does not execute it.

YOU WILL BE ABLE TO
  • Translate requirements into contracts
  • Implement and test a complete small slice
  • Explain production gaps and next increments
BUILD / TEST / EXPLAIN

Project brief and review

Build a small asynchronous producer/consumer pipeline with bounded pending work, explicit completion acknowledgments and structured task ownership. Make failure and shutdown part of the design rather than only processing the happy path. Reading time does not include your independent implementation time.

Requirements

  • Use a bounded asyncio.Queue.
  • Own workers inside a TaskGroup.
  • Acknowledge every consumed item.
  • Define a sentinel and output-order contract.

Acceptance checklist

These self-checks are page-local, not saved or automatically judged.

Further increments

  • Add multiple workers with an explicit reordering strategy.
  • Test producer failure, cancellation and a full queue with coordinated events.

Build this as a multi-file project: Bounded concurrent pipeline

A real finite local asyncio.Queue/TaskGroup program, not a browser scheduling model, process pool or durable broker. One worker, queue capacity two, None reserved as sentinel, exact integer inputs and FIFO output. Queue capacity excludes active work and the O(n) retained result list. Python 3.11+ is required. The lesson's single-file browser runner does not import these files.

  1. Preview and download the starter. In Standalone Playground, sign in and choose Import JSON as a new local project. Importing replaces local editor files only after its existing unsaved-edit confirmation; export your work first.
  2. Implement async pipeline(values, process=...) in pipeline.py. The default async process squares exact integer inputs, including zero and negatives, once each. A bounded queue and TaskGroup own one worker; acknowledge each retrieved item in finally, including the sentinel, join before success, and return only after worker shutdown.
  3. The optional async process callable is a deterministic test seam, not a remote transport. Propagate worker/producer failures and cancellation without a normal partial result or surviving worker. Use coordinated events, not timing claims, to demonstrate that a full queue pauses admission until work is released.
  4. Implement ordered_results(completed, expected) in transfer.py. Require an exact list of two-item rows, exact nonnegative expected count, unique complete integer positions in range and exact integer payloads (not bool). Return fresh values in position order without mutation. This finite collector does not implement a multiworker scheduler.
  5. Save snapshot explicitly, then Run current files to execute main.py's 8 public standard-library tests. The suite stops at the first failure; the untouched starter raises a real NotImplementedError. Inspect the named failing case, edit and rerun. Add an original test and explain why it would catch a tempting wrong approach.
  6. Stop an active program before changing its baseline. Export current project JSON to keep your exact files; import the original starter as a separate local project to reset, with the same edit-loss confirmation. A saved version can be restored explicitly. Record your saved artifact and limitations separately if private project self-review is enabled.

Public tests are visible and editable, not exhaustive grading or proof that you worked without the reference. No completion, reading milestone or judge acceptance is awarded. Run needs the independently enabled approved Python Playground runtime; if unavailable, source editing/export remains available without a fallback. Frameworks, cloud services, live APIs and persistent database sessions remain unsupported. For local work, download all previewed source files into the same empty folder and run python main.py from that folder in your own Python 3.11+ environment. Downloads do not install Python or provide offline server execution.

References are excluded by default. Including them changes only the new download, never your current lesson or saved project.

01

Project brief and boundaries

A bounded pipeline moves work through named stages without allowing unlimited waiting work. Acceptance, processing and completion are different promises.

READ / UNDERSTAND / THEN EXPERIMENT

Understand first

A producer can supply items faster than a worker finishes them. A queue gives them a handoff, but its capacity alone does not bound everything the project retains.

Words you will see

Backpressure
Making a producer wait when the next stage has no room.
In flight
Accepted work that has not yet been emitted or abandoned.
Invariant
A rule that must remain true after every state change.

Decompose the project contract

Start with finite integer inputs and square each accepted value exactly once. State whether results follow arrival order or completion order. The original one-worker project preserves arrival order. None is its stop marker, so None cannot also be ordinary input. Empty input must still stop the worker and return an empty list.

Write separate acceptance cases for admission, processing, acknowledgment and worker exit. A result list with three squares does not establish that the queue was joined or that no task survived. Keep the bounded asyncio.Queue and TaskGroup requirements in the independent project; the browser policy exercises below deliberately do not start concurrent workers.

Budget ownership before adding workers

The sample counts queued, active and completed-but-waiting items against a total window. It is a deterministic budget calculation, not an instrumented scheduler. The producer owns admission; a worker owns an item after retrieval; a collector owns retained output. Give each handoff one clear owner so cancellation does not leave work silently unaccounted for.

First test an empty window, a full window and one free slot. Then implement the real single-worker pipeline locally before introducing multiple workers. A queue-only bound is simpler but excludes active items and output. A whole-window bound is stricter and needs release accounting. For these fixed-size counts the sample uses constant work and space; actual retained bytes also depend on item size.

The original example, step by step

These steps explain the original code below. They do not change when you edit your own experiment.

  1. limit = 5

    Choose a whole-window limit, not a queue capacity.

  2. queued, active, waiting = 2, 1, 1

    Describe three disjoint ownership states.

  3. retained = queued + active + waiting

    Count all retained work once.

  4. room = max(0, limit - retained)

    Admit at most one more item in this fixture.

Build a small asynchronous producer/consumer pipeline with bounded pending work, explicit completion acknowledgments and structured task ownership. Make failure and shutdown part of the design rather than only processing the happy path.

Conceptual ownership flow, not a live scheduling trace

Conceptual reasoning steps for the original example, not a live trace of your edited Python.

  1. ProducerAdmit only when the chosen window has room.
  2. Queue and workerRetrieval moves ownership; acknowledgment balances queue accounting.
  3. CollectorEmit in the documented order and release retained work.
Predict before you run

How many slots remain in the original sample?

Budget a conceptual work windowPYTHON 3

Run your edited Python in the browser, or download it. Ctrl/Cmd + Enter runs. One example runs at a time; each run starts fresh. Save work and place stores a private copy of edited code. Run results remain local learning feedback. No third-party execution service receives your code.

Preparing the editor controls. Run and editing become available when this page is interactive.

Browser Python limits

Python 3.13 with browser-compatible standard-library modules and prebundled SQLite, a 4-second execution limit, 16 KiB output and a 256 MiB Python heap cap. First loading can take up to 45 seconds. Total browser memory is browser-governed. No network, learner package installation, interactive input, host files or system processes. SQLite databases and temporary files disappear after each run. Platform-specific examples may report unsupported modules; download those for a suitable local environment.

Change one thing; explain the difference.

Fill the last slot.

Try: Change waiting from 1 to 2.

retained becomes 5 and room becomes 0.

Expose an already-exceeded budget.

Try: Change limit from 5 to 3.

retained stays 4; room clamps to 0 rather than claiming negative admission. A real owner must diagnose the exceeded invariant.

Before you move on

With a window of six, two queued items, two active items and two completed items waiting for order, may the producer admit another?

Try explaining it in your own words. Running code is useful, but the explanation above gives you enough to reason it through first.

Read a worked answer

No. All six slots are retained. Completed-but-unemitted items still occupy the window; admitting another would exceed the stated bound.

This is a self-check, not a required quiz or a saved score. You can revisit any concept.
02

Design a testable slice

Acknowledgment balances retrieved work. It records that queue bookkeeping is finished, not that every business action succeeded.

READ / UNDERSTAND / THEN EXPERIMENT

Understand first

Missing acknowledgments can leave join waiting forever, while acknowledging twice corrupts the accounting. Failure must not be hidden behind a zero counter.

Words you will see

Acknowledgment
One completion-accounting action for one retrieved item.
Sentinel
A distinguished value that asks a worker to stop.
Structured ownership
Keeping child task lifetime inside a scope that waits for it or propagates its failure.

Separate the two completion questions

The ledger sample models retrieved item identities. A get event claims an identity; a done event removes it. At the end, b is still outstanding. It does not execute queue.get or queue.task_done. Distinct identities let tests reject duplicate acknowledgments even when payload values repeat.

In the actual project, place task_done in finally after every successful get, including the sentinel. Do not acknowledge an item that was never retrieved. A worker can raise after retrieval and still balance the counter. That balance permits accounting to finish but must not convert the failed project into a successful partial return.

Implement and test the ownership boundary

Build ledger tests for no events, repeated payloads with distinct identities, a missing done, an unknown done and a duplicate get. Then implement the real worker in a TaskGroup. Test error propagation and worker termination separately from output equality. A finally block handles acknowledgment; a resource-owning adapter may need additional cleanup.

A numeric counter is cheaper than an identity ledger but cannot explain which item remains. For e events and k outstanding identities, an insertion-ordered dictionary supports expected O(e) work and O(k) retained state under bounded identifier costs. The browser ledger is a diagnostic model. Actual cancellation and a blocked producer require a local asyncio lab with coordinated events, not arbitrary sleep durations.

The original example, step by step

These steps explain the original code below. They do not change when you edit your own experiment.

  1. events = [("get", "a")

    Record a finite fixture, not runtime queue events.

  2. pending = {}

    Create private insertion-ordered ownership state.

  3. if kind == "get":

    Branch between acquiring and releasing an identity.

  4. del pending[identity]

    Release a, leaving b outstanding.

One producer enqueues values then a sentinel. One worker consumes and acknowledges in finally. TaskGroup scopes the worker lifetime, while queue.join describes completion of enqueued work. The single-worker reference has a simple deterministic output order.

Predict before you run

Which identity remains in the sample?

Inspect an acknowledgment ledgerPYTHON 3

Run your edited Python in the browser, or download it. Ctrl/Cmd + Enter runs. One example runs at a time; each run starts fresh. Save work and place stores a private copy of edited code. Run results remain local learning feedback. No third-party execution service receives your code.

Preparing the editor controls. Run and editing become available when this page is interactive.

Browser Python limits

Python 3.13 with browser-compatible standard-library modules and prebundled SQLite, a 4-second execution limit, 16 KiB output and a 256 MiB Python heap cap. First loading can take up to 45 seconds. Total browser memory is browser-governed. No network, learner package installation, interactive input, host files or system processes. SQLite databases and temporary files disappear after each run. Platform-specific examples may report unsupported modules; download those for a suitable local environment.

Change one thing; explain the difference.

Balance the remaining item.

Try: Append ("done", "b") to events.

The pending list becomes empty, showing accounting only.

Expose an unknown release.

Try: Append ("done", "missing") to events.

The simple sample raises KeyError. The guided validator converts malformed event histories into the documented ValueError.

Before you move on

A worker raises while handling item c, then calls task_done in finally. Has c necessarily produced a valid result?

Try explaining it in your own words. Running code is useful, but the explanation above gives you enough to reason it through first.

Read a worked answer

No. Accounting was balanced, but processing failed. Preserve the error and avoid returning a normal complete report; TaskGroup ownership helps propagate the failure.

This is a self-check, not a required quiz or a saved score. You can revisit any concept.
03

A complete bounded local pipeline

The original asynchronous reference is a complete small happy-path pipeline. Read its resource scope separately from its square calculation.

READ / UNDERSTAND / THEN EXPERIMENT

Understand first

The project requires a real bounded queue, acknowledgment and structured task ownership. A policy exercise cannot replace that implementation.

Words you will see

TaskGroup
An asyncio scope that owns child tasks and waits for their exit.
join
A queue wait until enqueued items have matching acknowledgments.
Cooperative scheduling
Tasks making progress when await allows another task to run.

Walk through the preserved implementation

pipeline creates a capacity-two queue and a private result list. Its nested worker repeatedly retrieves an item. None returns from the worker, but the finally block still acknowledges it. Ordinary values append their squares before acknowledgment. The producer enqueues values, then the sentinel, then awaits join while the worker remains owned by TaskGroup.

Leaving the TaskGroup waits for task completion before returning result. With one worker, retrieval and appending preserve input order, so 2, 3 and 4 yield 4, 9 and 16. The sentinel contributes accounting but no result. Empty values still enqueue the sentinel. An exception in processing must propagate rather than presenting the earlier squares as a complete answer.

Distinguish runnable evidence from project completion

This preserved reference uses local asyncio only: no threads, processes, sockets or durable queue. It is a browser-local cooperative example where the runtime supports asyncio, and it also runs in standard local Python. The three browser exercises model deterministic data policies instead of scheduling. Neither kind of sample is a throughput measurement or a completed deployment.

Rebuild the project independently with the reference closed. In a local Python 3.11+ lab, coordinate full-queue blocking, producer failure and caller cancellation with asyncio.Event and explicit test deadlines. Check no owned task remains afterward. The result list retains O(n) output for n inputs; capacity two bounds pending queue entries, not total memory. More workers change sentinel distribution and ordering, so add them only after the single-worker cases pass.

The original example, step by step

These steps explain the original code below. They do not change when you edit your own experiment.

  1. queue = asyncio.Queue(maxsize=2)

    Bound waiting queue entries.

  2. item = await queue.get()

    Transfer one item to the worker.

  3. queue.task_done()

    Balance every retrieval, even the stop marker.

  4. await queue.join()

    Wait for accounting while TaskGroup still owns the worker.

The bounded queue creates backpressure during production. A single scoped worker preserves order, acknowledges every item including the sentinel and exits before the result is returned.

Predict before you run

Why does the final list keep input order?

A complete bounded local pipelinePYTHON 3

Run your edited Python in the browser, or download it. Ctrl/Cmd + Enter runs. One example runs at a time; each run starts fresh. Save work and place stores a private copy of edited code. Run results remain local learning feedback. No third-party execution service receives your code.

Preparing the editor controls. Run and editing become available when this page is interactive.

Browser Python limits

Python 3.13 with browser-compatible standard-library modules and prebundled SQLite, a 4-second execution limit, 16 KiB output and a 256 MiB Python heap cap. First loading can take up to 45 seconds. Total browser memory is browser-governed. No network, learner package installation, interactive input, host files or system processes. SQLite databases and temporary files disappear after each run. Platform-specific examples may report unsupported modules; download those for a suitable local environment.

Change one thing; explain the difference.

Include a zero.

Try: Change the final input to [0, 3].

The output becomes [0, 9]; zero is data, unlike None.

Test empty input.

Try: Change the final input to [].

The sentinel is still consumed and acknowledged; the result is [].

Before you move on

For inputs [0, 0], how many results and acknowledgments does the original worker make?

Try explaining it in your own words. Running code is useful, but the explanation above gives you enough to reason it through first.

Read a worked answer

It appends two zero results and acknowledges three retrieved entries: the two values and the sentinel. Repeated values are separate work items.

This is a self-check, not a required quiz or a saved score. You can revisit any concept.
DETAILED WALKTHROUGH / NOT JUST A SUMMARY

State acceptance, completion and ordering independently

A bounded asyncio.Queue limits pending local items; a TaskGroup owns worker lifetimes; task_done accounts for each retrieved item; and queue.join waits for acknowledgment accounting. These are related but distinct mechanisms. Define when an input becomes accepted, what a result means, and whether order follows input or completion. The reference has one worker, queue capacity two, and None as a sentinel, so None cannot simultaneously be an ordinary supported input value.

For inputs 2, 3, and 4, the worker appends their squares in order and acknowledges every retrieved item in finally, including the sentinel. The producer waits for queue.join inside the worker-owning TaskGroup, and the result is returned after the scope exits. This proves a small local happy-path slice. It does not provide durable delivery, real process pools, cross-machine scheduling, or recovery of accepted items after process loss.

Build numbered increments with explicit task ownership

1. Implement one worker with a finite input and deterministic results. 2. Add a small queue capacity and verify producer backpressure. 3. Add the sentinel and acknowledgment in finally. 4. Place workers inside TaskGroup and wait for completion. 5. Add injected worker failures and cancellation tests. Only then add multiple workers, because doing so changes ordering, sentinel distribution, active-work accounting, and the number of tasks involved in shutdown.

Every successful get must have one matching task_done, including an item whose processing raises. Acknowledgment means the queue's unfinished-item counter was decremented; it does not mean an external side effect committed. Excess acknowledgments are errors, while missing ones can leave join waiting forever. TaskGroup failure propagation prevents a worker exception from being silently ignored, but you must still define the fate of already accepted items and avoid a normal partial-success return.

Test progress and failure with coordinated events

Acceptance tests cover empty input, the three-square fixture, every accepted value producing one result, worker termination after the sentinel, and join completing before success. Coordinate a blocked worker with events so a full queue visibly blocks the producer until capacity is released. Avoid sleep-based timing assertions. For multiple workers, assign sequence positions and test whichever ordering contract you chose rather than assuming concurrent completion naturally preserves arrival order.

Inject failure during processing and assert propagation, sibling cancellation, and absence of a success-shaped partial result. Test producer failure, caller cancellation while put is blocked, and shutdown while the queue is full. Account for sentinel consumption and ensure no worker is left waiting after normal completion. Use a unique sentinel object if None becomes valid data. Resource-owning adapters need their own finally cleanup when cancellation interrupts processing, not just queue acknowledgment.

Budget total retained work and independent effort

Queue capacity bounds queued items, not worker-held items, retained results, or the input iterable. The reference accumulates every square in a list, so total output memory is O(n), even with capacity two. Multiple workers add active items, and reordering can accumulate completed results behind a slow earlier item. Set item-size limits and a result-consumption policy. A durable broker is needed when recovery requirements exceed what local memory can survive.

Plan separate implementation blocks for the deterministic worker, backpressure tests, and failure or cancellation behavior. Expect concurrency debugging to require revisiting ownership rather than merely raising worker count. Before consulting the reference, write an invariant table for accepted, queued, active, acknowledged, and completed items. Review actual evidence and unsupported conditions afterward. This project demonstrates local cooperative concurrency; claiming throughput improvements or production recovery requires representative measurements and additional infrastructure-specific integration tests.

Transfer question: Four workers must preserve input order, but the first item is much slower than all later items. What resource risk appears?

Sequence numbers let a collector restore input order, but later completed results can accumulate while it waits for the first item. A bounded input queue does not bound this reorder buffer. Bound the total in-flight window, including queued, active, and completed-but-unemitted items, or change the contract to completion order if callers permit it. Test by holding the first worker result with an event while later work completes and observing the maximum retained window. Define cancellation and failure behavior for the collector so it does not wait forever for a sequence position whose task already failed.

RECALL BEFORE YOU SCROLL

Can you explain it?

Try from memory. Feedback stays on this page and does not award judged progress.

When is this project ready for your self-review?
TRANSFER THE IDEA

Build before opening the reference

Use a bounded asyncio.Queue. Own workers inside a TaskGroup. Acknowledge every consumed item. Define a sentinel and output-order contract. Demonstrate the acceptance cases and document any unsupported requirement.

Your practice starterPYTHON 3

Run your edited Python in the browser, or download it. Ctrl/Cmd + Enter runs. One example runs at a time; each run starts fresh. Save work and place stores a private copy of edited code. Run results remain local learning feedback. No third-party execution service receives your code.

Preparing the editor controls. Run and editing become available when this page is interactive.

Browser Python limits

Python 3.13 with browser-compatible standard-library modules and prebundled SQLite, a 4-second execution limit, 16 KiB output and a 256 MiB Python heap cap. First loading can take up to 45 seconds. Total browser memory is browser-governed. No network, learner package installation, interactive input, host files or system processes. SQLite databases and temporary files disappear after each run. Platform-specific examples may report unsupported modules; download those for a suitable local environment.

MAKE THE RULE WORK ON NEW INPUTS

Guided practice and transfer

These are public local learning checks, not certified scores. Edited code is saved only with Save work and place. Run results are not stored as certified scores. Export useful unsaved work before leaving.

A short function primer before you begin

def names a reusable rule. The input names in parentheses are parameters. Indent its body; replace the starter's pass placeholder. The body runs when called, not when defined.

return hands a value back and ends that call. print only displays a value. The public assert checks call your function with fresh fixtures; a false condition raises AssertionError with its message.

Return a value, do not only print itPYTHON 3

Run your edited Python in the browser, or download it. Ctrl/Cmd + Enter runs. One example runs at a time; each run starts fresh. Save work and place stores a private copy of edited code. Run results remain local learning feedback. No third-party execution service receives your code.

Preparing the editor controls. Run and editing become available when this page is interactive.

Browser Python limits

Python 3.13 with browser-compatible standard-library modules and prebundled SQLite, a 4-second execution limit, 16 KiB output and a 256 MiB Python heap cap. First loading can take up to 45 seconds. Total browser memory is browser-governed. No network, learner package installation, interactive input, host files or system processes. SQLite databases and temporary files disappear after each run. Platform-specific examples may report unsupported modules; download those for a suitable local environment.

GUIDED PRACTICE

Increment 1: admit a bounded prefix

Implement the whole-window admission policy as data, before building the actual queue.

The contract

  • values is an exact list of exact nonnegative integers. Validate every value, including any outside the admitted prefix; bool is invalid.
  • capacity and retained are exact integers with 0 <= retained <= capacity. Invalid input raises ValueError.
  • Return a fresh list of at most capacity-retained values from the front, preserving order, zeros and duplicates. Never mutate input. Browser-local policy only; no live tasks or I/O.
Increment 1: admit a bounded prefixPYTHON 3

Run your edited Python in the browser, or download it. Ctrl/Cmd + Enter runs. One example runs at a time; each run starts fresh. Save work and place stores a private copy of edited code. Run results remain local learning feedback. No third-party execution service receives your code.

Preparing the editor controls. Run and editing become available when this page is interactive.

Browser Python limits

Python 3.13 with browser-compatible standard-library modules and prebundled SQLite, a 4-second execution limit, 16 KiB output and a 256 MiB Python heap cap. First loading can take up to 45 seconds. Total browser memory is browser-governed. No network, learner package installation, interactive input, host files or system processes. SQLite databases and temporary files disappear after each run. Platform-specific examples may report unsupported modules; download those for a suitable local environment.

Inspect 6 public checks

Transparent local learning checks, not exhaustive or tamper-proof grading.

  1. Prefix with duplicates
    from copy import deepcopy
    arguments = ([3, 3, 0, 9], 4, 1)
    before = deepcopy(arguments)
    try:
        result = admit(*arguments)
    except ValueError:
        result = ("ValueError",)
    assert arguments == before, "Caller input changed"
    expected = [3, 3, 0]
    assert type(result) is type(expected), "Wrong result type"
    assert result == expected, "Wrong result value"
    def check_types(actual, target):
        assert type(actual) is type(target), "Wrong nested result type"
        if type(target) in (list, tuple):
            for item, wanted in zip(actual, target):
                check_types(item, wanted)
        elif type(target) is dict:
            for key in target:
                check_types(actual[key], target[key])
    check_types(result, expected)
    if type(result) is list:
        result.append(("ownership-probe", 0))
    elif type(result) is dict:
        for value in result.values():
            if type(value) is list:
                value.append(("ownership-probe", 0))
    assert arguments == before, "Caller input changed through result alias"
    
  2. Empty values
    from copy import deepcopy
    arguments = ([], 2, 0)
    before = deepcopy(arguments)
    try:
        result = admit(*arguments)
    except ValueError:
        result = ("ValueError",)
    assert arguments == before, "Caller input changed"
    expected = []
    assert type(result) is type(expected), "Wrong result type"
    assert result == expected, "Wrong result value"
    def check_types(actual, target):
        assert type(actual) is type(target), "Wrong nested result type"
        if type(target) in (list, tuple):
            for item, wanted in zip(actual, target):
                check_types(item, wanted)
        elif type(target) is dict:
            for key in target:
                check_types(actual[key], target[key])
    check_types(result, expected)
    if type(result) is list:
        result.append(("ownership-probe", 0))
    elif type(result) is dict:
        for value in result.values():
            if type(value) is list:
                value.append(("ownership-probe", 0))
    assert arguments == before, "Caller input changed through result alias"
    
  3. Full window
    from copy import deepcopy
    arguments = ([2, 1], 2, 2)
    before = deepcopy(arguments)
    try:
        result = admit(*arguments)
    except ValueError:
        result = ("ValueError",)
    assert arguments == before, "Caller input changed"
    expected = []
    assert type(result) is type(expected), "Wrong result type"
    assert result == expected, "Wrong result value"
    def check_types(actual, target):
        assert type(actual) is type(target), "Wrong nested result type"
        if type(target) in (list, tuple):
            for item, wanted in zip(actual, target):
                check_types(item, wanted)
        elif type(target) is dict:
            for key in target:
                check_types(actual[key], target[key])
    check_types(result, expected)
    if type(result) is list:
        result.append(("ownership-probe", 0))
    elif type(result) is dict:
        for value in result.values():
            if type(value) is list:
                value.append(("ownership-probe", 0))
    assert arguments == before, "Caller input changed through result alias"
    
  4. Entire list remains private
    from copy import deepcopy
    arguments = ([0, 2], 3, 0)
    before = deepcopy(arguments)
    try:
        result = admit(*arguments)
    except ValueError:
        result = ("ValueError",)
    assert arguments == before, "Caller input changed"
    expected = [0, 2]
    assert type(result) is type(expected), "Wrong result type"
    assert result == expected, "Wrong result value"
    def check_types(actual, target):
        assert type(actual) is type(target), "Wrong nested result type"
        if type(target) in (list, tuple):
            for item, wanted in zip(actual, target):
                check_types(item, wanted)
        elif type(target) is dict:
            for key in target:
                check_types(actual[key], target[key])
    check_types(result, expected)
    if type(result) is list:
        result.append(("ownership-probe", 0))
    elif type(result) is dict:
        for value in result.values():
            if type(value) is list:
                value.append(("ownership-probe", 0))
    assert arguments == before, "Caller input changed through result alias"
    
  5. Invalid unadmitted tail
    from copy import deepcopy
    arguments = ([2, True], 1, 0)
    before = deepcopy(arguments)
    try:
        result = admit(*arguments)
    except ValueError:
        result = ("ValueError",)
    assert arguments == before, "Caller input changed"
    expected = ("ValueError",)
    assert type(result) is type(expected), "Wrong result type"
    assert result == expected, "Wrong result value"
    def check_types(actual, target):
        assert type(actual) is type(target), "Wrong nested result type"
        if type(target) in (list, tuple):
            for item, wanted in zip(actual, target):
                check_types(item, wanted)
        elif type(target) is dict:
            for key in target:
                check_types(actual[key], target[key])
    check_types(result, expected)
    
    
  6. Overdrawn budget
    from copy import deepcopy
    arguments = ([1], 2, 3)
    before = deepcopy(arguments)
    try:
        result = admit(*arguments)
    except ValueError:
        result = ("ValueError",)
    assert arguments == before, "Caller input changed"
    expected = ("ValueError",)
    assert type(result) is type(expected), "Wrong result type"
    assert result == expected, "Wrong result value"
    def check_types(actual, target):
        assert type(actual) is type(target), "Wrong nested result type"
        if type(target) in (list, tuple):
            for item, wanted in zip(actual, target):
                check_types(item, wanted)
        elif type(target) is dict:
            for key in target:
                check_types(actual[key], target[key])
    check_types(result, expected)
    
    
    Does a free slot prove the real producer can progress?

    Validation prevents a bad unadmitted tail from disappearing. A slice preserves repetitions and returns a fresh list even when the whole input fits. For n supplied values and m admitted values, work is O(n + m) and output space O(m). No. This models policy only. A local asyncio test must demonstrate the producer waiting and resuming with coordinated events.

    GUIDED PRACTICE

    Increment 2: validate acknowledgment ownership

    Build a diagnostic ledger that distinguishes accounting from processing success.

    The contract

    • events is an exact list of two-item lists/tuples (kind, identity); kind is 'get' or 'done', identity a nonempty exact string. Invalid histories raise ValueError.
    • Each identity has at most one get over the entire history. A done must release a currently pending get once. Acknowledged identities may not be reused.
    • Return a new list of still-pending identity strings in get order. Preserve all nested input rows. No queue, network or task is started; this is a finite browser ledger.
    Increment 2: validate acknowledgment ownershipPYTHON 3

    Run your edited Python in the browser, or download it. Ctrl/Cmd + Enter runs. One example runs at a time; each run starts fresh. Save work and place stores a private copy of edited code. Run results remain local learning feedback. No third-party execution service receives your code.

    Preparing the editor controls. Run and editing become available when this page is interactive.

    Browser Python limits

    Python 3.13 with browser-compatible standard-library modules and prebundled SQLite, a 4-second execution limit, 16 KiB output and a 256 MiB Python heap cap. First loading can take up to 45 seconds. Total browser memory is browser-governed. No network, learner package installation, interactive input, host files or system processes. SQLite databases and temporary files disappear after each run. Platform-specific examples may report unsupported modules; download those for a suitable local environment.

    Inspect 6 public checks

    Transparent local learning checks, not exhaustive or tamper-proof grading.

    1. Pending get order
      from copy import deepcopy
      arguments = ([('get', 'b'), ('get', 'a'), ('get', 'c'), ('done', 'a')],)
      before = deepcopy(arguments)
      try:
          result = pending_ids(*arguments)
      except ValueError:
          result = ("ValueError",)
      assert arguments == before, "Caller input changed"
      expected = ['b', 'c']
      assert type(result) is type(expected), "Wrong result type"
      assert result == expected, "Wrong result value"
      def check_types(actual, target):
          assert type(actual) is type(target), "Wrong nested result type"
          if type(target) in (list, tuple):
              for item, wanted in zip(actual, target):
                  check_types(item, wanted)
          elif type(target) is dict:
              for key in target:
                  check_types(actual[key], target[key])
      check_types(result, expected)
      if type(result) is list:
          result.append(("ownership-probe", 0))
      elif type(result) is dict:
          for value in result.values():
              if type(value) is list:
                  value.append(("ownership-probe", 0))
      assert arguments == before, "Caller input changed through result alias"
      
    2. Empty history
      from copy import deepcopy
      arguments = ([],)
      before = deepcopy(arguments)
      try:
          result = pending_ids(*arguments)
      except ValueError:
          result = ("ValueError",)
      assert arguments == before, "Caller input changed"
      expected = []
      assert type(result) is type(expected), "Wrong result type"
      assert result == expected, "Wrong result value"
      def check_types(actual, target):
          assert type(actual) is type(target), "Wrong nested result type"
          if type(target) in (list, tuple):
              for item, wanted in zip(actual, target):
                  check_types(item, wanted)
          elif type(target) is dict:
              for key in target:
                  check_types(actual[key], target[key])
      check_types(result, expected)
      if type(result) is list:
          result.append(("ownership-probe", 0))
      elif type(result) is dict:
          for value in result.values():
              if type(value) is list:
                  value.append(("ownership-probe", 0))
      assert arguments == before, "Caller input changed through result alias"
      
    3. All acknowledged
      from copy import deepcopy
      arguments = ([['get', 'x'], ['done', 'x']],)
      before = deepcopy(arguments)
      try:
          result = pending_ids(*arguments)
      except ValueError:
          result = ("ValueError",)
      assert arguments == before, "Caller input changed"
      expected = []
      assert type(result) is type(expected), "Wrong result type"
      assert result == expected, "Wrong result value"
      def check_types(actual, target):
          assert type(actual) is type(target), "Wrong nested result type"
          if type(target) in (list, tuple):
              for item, wanted in zip(actual, target):
                  check_types(item, wanted)
          elif type(target) is dict:
              for key in target:
                  check_types(actual[key], target[key])
      check_types(result, expected)
      if type(result) is list:
          result.append(("ownership-probe", 0))
      elif type(result) is dict:
          for value in result.values():
              if type(value) is list:
                  value.append(("ownership-probe", 0))
      assert arguments == before, "Caller input changed through result alias"
      
    4. Duplicate done
      from copy import deepcopy
      arguments = ([('get', 'x'), ('done', 'x'), ('done', 'x')],)
      before = deepcopy(arguments)
      try:
          result = pending_ids(*arguments)
      except ValueError:
          result = ("ValueError",)
      assert arguments == before, "Caller input changed"
      expected = ("ValueError",)
      assert type(result) is type(expected), "Wrong result type"
      assert result == expected, "Wrong result value"
      def check_types(actual, target):
          assert type(actual) is type(target), "Wrong nested result type"
          if type(target) in (list, tuple):
              for item, wanted in zip(actual, target):
                  check_types(item, wanted)
          elif type(target) is dict:
              for key in target:
                  check_types(actual[key], target[key])
      check_types(result, expected)
      
      
    5. Identity cannot be reused
      from copy import deepcopy
      arguments = ([('get', 'x'), ('done', 'x'), ('get', 'x')],)
      before = deepcopy(arguments)
      try:
          result = pending_ids(*arguments)
      except ValueError:
          result = ("ValueError",)
      assert arguments == before, "Caller input changed"
      expected = ("ValueError",)
      assert type(result) is type(expected), "Wrong result type"
      assert result == expected, "Wrong result value"
      def check_types(actual, target):
          assert type(actual) is type(target), "Wrong nested result type"
          if type(target) in (list, tuple):
              for item, wanted in zip(actual, target):
                  check_types(item, wanted)
          elif type(target) is dict:
              for key in target:
                  check_types(actual[key], target[key])
      check_types(result, expected)
      
      
    6. Unknown acknowledgment
      from copy import deepcopy
      arguments = ([('done', 'x')],)
      before = deepcopy(arguments)
      try:
          result = pending_ids(*arguments)
      except ValueError:
          result = ("ValueError",)
      assert arguments == before, "Caller input changed"
      expected = ("ValueError",)
      assert type(result) is type(expected), "Wrong result type"
      assert result == expected, "Wrong result value"
      def check_types(actual, target):
          assert type(actual) is type(target), "Wrong nested result type"
          if type(target) in (list, tuple):
              for item, wanted in zip(actual, target):
                  check_types(item, wanted)
          elif type(target) is dict:
              for key in target:
                  check_types(actual[key], target[key])
      check_types(result, expected)
      
      
      Why not use only an integer outstanding counter?

      The seen set forbids identity reuse after acknowledgment; the pending dictionary expresses current ownership. Under bounded string costs, e events need expected O(e) work and O(e) history storage. A counter cannot distinguish an acknowledgment for the wrong item from one for a pending item, and cannot report the pending identities.

      TRANSFER / TRY BEFORE OPENING HINTS

      Transfer: restore a complete input-ordered result

      Change from pending ownership to complete result collection. Refuse missing work rather than returning a truncated success.

      The contract

      • completed is an exact list of two-item lists/tuples (position, value). expected is an exact nonnegative integer.
      • Positions are exact integers in range(expected), unique, and collectively complete. Values are exact integers, including negative values and zero. Reject bool, duplicate/out-of-range slots or missing results with ValueError.
      • Return a fresh list of values in position order, not value or completion order. Preserve nested input. This finite browser policy does not run multiple workers or prove scheduler progress.
      Transfer: restore a complete input-ordered resultPYTHON 3

      Run your edited Python in the browser, or download it. Ctrl/Cmd + Enter runs. One example runs at a time; each run starts fresh. Save work and place stores a private copy of edited code. Run results remain local learning feedback. No third-party execution service receives your code.

      Preparing the editor controls. Run and editing become available when this page is interactive.

      Browser Python limits

      Python 3.13 with browser-compatible standard-library modules and prebundled SQLite, a 4-second execution limit, 16 KiB output and a 256 MiB Python heap cap. First loading can take up to 45 seconds. Total browser memory is browser-governed. No network, learner package installation, interactive input, host files or system processes. SQLite databases and temporary files disappear after each run. Platform-specific examples may report unsupported modules; download those for a suitable local environment.

      Inspect 6 public checks

      Transparent local learning checks, not exhaustive or tamper-proof grading.

      1. Out-of-order completion
        from copy import deepcopy
        arguments = ([(2, 4), (0, 9), (1, 9)], 3)
        before = deepcopy(arguments)
        try:
            result = ordered_results(*arguments)
        except ValueError:
            result = ("ValueError",)
        assert arguments == before, "Caller input changed"
        expected = [9, 9, 4]
        assert type(result) is type(expected), "Wrong result type"
        assert result == expected, "Wrong result value"
        def check_types(actual, target):
            assert type(actual) is type(target), "Wrong nested result type"
            if type(target) in (list, tuple):
                for item, wanted in zip(actual, target):
                    check_types(item, wanted)
            elif type(target) is dict:
                for key in target:
                    check_types(actual[key], target[key])
        check_types(result, expected)
        if type(result) is list:
            result.append(("ownership-probe", 0))
        elif type(result) is dict:
            for value in result.values():
                if type(value) is list:
                    value.append(("ownership-probe", 0))
        assert arguments == before, "Caller input changed through result alias"
        
      2. Empty complete batch
        from copy import deepcopy
        arguments = ([], 0)
        before = deepcopy(arguments)
        try:
            result = ordered_results(*arguments)
        except ValueError:
            result = ("ValueError",)
        assert arguments == before, "Caller input changed"
        expected = []
        assert type(result) is type(expected), "Wrong result type"
        assert result == expected, "Wrong result value"
        def check_types(actual, target):
            assert type(actual) is type(target), "Wrong nested result type"
            if type(target) in (list, tuple):
                for item, wanted in zip(actual, target):
                    check_types(item, wanted)
            elif type(target) is dict:
                for key in target:
                    check_types(actual[key], target[key])
        check_types(result, expected)
        if type(result) is list:
            result.append(("ownership-probe", 0))
        elif type(result) is dict:
            for value in result.values():
                if type(value) is list:
                    value.append(("ownership-probe", 0))
        assert arguments == before, "Caller input changed through result alias"
        
      3. Signed boundary values
        from copy import deepcopy
        arguments = ([[1, 0], [0, -2]], 2)
        before = deepcopy(arguments)
        try:
            result = ordered_results(*arguments)
        except ValueError:
            result = ("ValueError",)
        assert arguments == before, "Caller input changed"
        expected = [-2, 0]
        assert type(result) is type(expected), "Wrong result type"
        assert result == expected, "Wrong result value"
        def check_types(actual, target):
            assert type(actual) is type(target), "Wrong nested result type"
            if type(target) in (list, tuple):
                for item, wanted in zip(actual, target):
                    check_types(item, wanted)
            elif type(target) is dict:
                for key in target:
                    check_types(actual[key], target[key])
        check_types(result, expected)
        if type(result) is list:
            result.append(("ownership-probe", 0))
        elif type(result) is dict:
            for value in result.values():
                if type(value) is list:
                    value.append(("ownership-probe", 0))
        assert arguments == before, "Caller input changed through result alias"
        
      4. Missing position
        from copy import deepcopy
        arguments = ([(1, 4)], 2)
        before = deepcopy(arguments)
        try:
            result = ordered_results(*arguments)
        except ValueError:
            result = ("ValueError",)
        assert arguments == before, "Caller input changed"
        expected = ("ValueError",)
        assert type(result) is type(expected), "Wrong result type"
        assert result == expected, "Wrong result value"
        def check_types(actual, target):
            assert type(actual) is type(target), "Wrong nested result type"
            if type(target) in (list, tuple):
                for item, wanted in zip(actual, target):
                    check_types(item, wanted)
            elif type(target) is dict:
                for key in target:
                    check_types(actual[key], target[key])
        check_types(result, expected)
        
        
      5. Duplicate position
        from copy import deepcopy
        arguments = ([(0, 2), (0, 3)], 2)
        before = deepcopy(arguments)
        try:
            result = ordered_results(*arguments)
        except ValueError:
            result = ("ValueError",)
        assert arguments == before, "Caller input changed"
        expected = ("ValueError",)
        assert type(result) is type(expected), "Wrong result type"
        assert result == expected, "Wrong result value"
        def check_types(actual, target):
            assert type(actual) is type(target), "Wrong nested result type"
            if type(target) in (list, tuple):
                for item, wanted in zip(actual, target):
                    check_types(item, wanted)
            elif type(target) is dict:
                for key in target:
                    check_types(actual[key], target[key])
        check_types(result, expected)
        
        
      6. Bool position
        from copy import deepcopy
        arguments = ([(True, 7)], 1)
        before = deepcopy(arguments)
        try:
            result = ordered_results(*arguments)
        except ValueError:
            result = ("ValueError",)
        assert arguments == before, "Caller input changed"
        expected = ("ValueError",)
        assert type(result) is type(expected), "Wrong result type"
        assert result == expected, "Wrong result value"
        def check_types(actual, target):
            assert type(actual) is type(target), "Wrong nested result type"
            if type(target) in (list, tuple):
                for item, wanted in zip(actual, target):
                    check_types(item, wanted)
            elif type(target) is dict:
                for key in target:
                    check_types(actual[key], target[key])
        check_types(result, expected)
        
        
        Why not return sorted(value for _, value in completed)?

        A position dictionary preserves repeated result values without confusing them with duplicate jobs. Completeness is checked against the declared expected count. For n completed results, expected work and space are O(n), assuming bounded integer operations. That sorts payloads instead of restoring input positions and cannot detect missing or duplicated positions.

        A GOOD PLACE TO PAUSE

        Core route complete.

        If you can explain the checkpoint and attempt the practice, move on. Come back for the deep dive when you want the why behind the how.

        Save your core reading milestone

        Production hardening is separate

        Restoring input order after concurrent completion is a separate collection policy. Sequence positions preserve duplicates without comparing payloads.

        READ / UNDERSTAND / THEN EXPERIMENT

        Understand first

        A slow early task can leave later completed results waiting. A bounded input queue does not bound that reorder buffer.

        Words you will see

        Sequence position
        An integer marking an item's original input slot.
        Reorder buffer
        Completed results retained until the next required position is available.
        Head-of-line blocking
        Later ready results waiting for an earlier missing result.

        Define what completeness means

        The sample receives completions for positions two, zero and one. It stores them by position and reads zero through two. This yields input order without sorting the squared payloads. Validate positions as exact integers, reject duplicates and require every expected position before returning. Otherwise a lost result can look like a short successful list.

        A completed list is not the same as a live collector. A live implementation must stop waiting if the owner reports a failed task, rather than awaiting a position that can never arrive. Cancellation also needs to dispose of buffered results and their resources. Keep these owner decisions outside the deterministic ordering function.

        Choose the cost deliberately

        Completion-order output can release ready items sooner if callers permit it, but it changes the project's original contract. Input-order output retains a prefix gap. For n expected results, the finite model takes expected O(n) work and O(n) output plus lookup storage under fixed-size position and value assumptions.

        For the independent multi-worker extension, bound queued, active and completed-but-unemitted work together. In a local lab hold position zero with an event while later work finishes, then check the maximum retained window. Browser checks establish the finite ordering policy only. They do not prove fairness, real backpressure, scheduler progress or memory limits in a running service.

        The original example, step by step

        These steps explain the original code below. They do not change when you edit your own experiment.

        1. completed = [(2, 16), (0, 4), (1, 9)]

          Model out-of-order completion.

        2. by_position = dict(completed)

          Index this valid fixture by original position.

        3. expected = 3

          Declare the required number independently of received data.

        4. ordered = [by_position[index] for index in range(expected)]

          Read every required slot in arrival order.

        A local queue is not durable and cannot recover after process loss. Add bounded retries, timeouts, monitoring and a durable handoff if required. Test cancellation without arbitrary sleeps and define what happens to accepted-but-unfinished items.

        Predict before you run

        What determines the sample output order?

        Restore positions, not sorted payloadsPYTHON 3

        Run your edited Python in the browser, or download it. Ctrl/Cmd + Enter runs. One example runs at a time; each run starts fresh. Save work and place stores a private copy of edited code. Run results remain local learning feedback. No third-party execution service receives your code.

        Preparing the editor controls. Run and editing become available when this page is interactive.

        Browser Python limits

        Python 3.13 with browser-compatible standard-library modules and prebundled SQLite, a 4-second execution limit, 16 KiB output and a 256 MiB Python heap cap. First loading can take up to 45 seconds. Total browser memory is browser-governed. No network, learner package installation, interactive input, host files or system processes. SQLite databases and temporary files disappear after each run. Platform-specific examples may report unsupported modules; download those for a suitable local environment.

        Change one thing; explain the difference.

        Keep the same positions but change a result.

        Try: Change (0, 4) to (0, 100).

        The output becomes [100, 9, 16], proving it is not sorted by value.

        Make one position absent.

        Try: Remove (1, 9).

        The sample raises KeyError; the transfer gives a documented ValueError for incomplete input.

        Before you move on

        If position zero fails while one and two complete, may a collector return only those two results as complete?

        Try explaining it in your own words. Running code is useful, but the explanation above gives you enough to reason it through first.

        Read a worked answer

        No. It must surface failure or a separately specified partial-result mode. Waiting forever or shrinking expected to two would also hide the failed position.

        This is a self-check, not a required quiz or a saved score. You can revisit any concept.

        Review and transfer

        Failure classification determines what can be retried. A retry limit bounds attempts but cannot by itself prevent duplicate effects.

        READ / UNDERSTAND / THEN EXPERIMENT

        Understand first

        Retrying a pure square calculation is unlike repeating an external charge. The project needs an honest recovery boundary before adding retry loops.

        Words you will see

        Retry budget
        The maximum permitted number of attempts.
        Idempotency
        Repeated execution having the same intended effect as one execution.
        Durability
        State surviving the relevant process or machine failure.

        Model policy without pretending to recover

        The sample allows retry only for a transient classification below the attempt budget. Permanent errors stop immediately. Attempt one means one attempt has already occurred. Unknown categories should not become retryable just because they are unfamiliar. This calculation neither waits nor retries any operation.

        For the real project, identify the point at which an item was accepted and the point at which its side effect committed. A worker can fail between those points, or after commit but before reporting success. Queue acknowledgment cannot settle that ambiguity. If external effects are introduced, define a request identity and recovery record at the effect boundary.

        Keep operational work independently testable

        First test the policy at zero remaining attempts and at the final permitted attempt. Then inject processing failures in the local pipeline, assert sibling cancellation and forbid a success-shaped partial list. Add deadlines to prevent tests hanging. A retry adapter needs tests for classification, cleanup and duplicate-effect behavior, separate from the pure worker.

        Local asyncio queues vanish on process loss. Durable handoff requires additional infrastructure and integration evidence. Browser increments are not a completed deployment and do not prove local cancellation behavior. Implement and review those labs independently. A finite policy lookup has constant cost here; a real retry loop multiplies work by attempts and can retain inputs and diagnostics, so bound both attempts and retained data.

        The original example, step by step

        These steps explain the original code below. They do not change when you edit your own experiment.

        1. budget = 3

          Permit at most three total attempts.

        2. failures = [("transient", 1)

          Describe classified failures as ordinary data.

        3. kind == "transient" and attempts < budget

          Require both a retryable category and remaining budget.

        4. print(retry)

          Observe decisions, not actual retries.

        After implementation, explain the boundary cases and change one requirement without rewriting unrelated behaviour. Add multiple workers with an explicit reordering strategy. Test producer failure, cancellation and a full queue with coordinated events. Keep a record of what you tested; a viewed reference is not proof you independently completed the project.

        Predict before you run

        Why is the last decision False?

        Make the retry decision explicitPYTHON 3

        Run your edited Python in the browser, or download it. Ctrl/Cmd + Enter runs. One example runs at a time; each run starts fresh. Save work and place stores a private copy of edited code. Run results remain local learning feedback. No third-party execution service receives your code.

        Preparing the editor controls. Run and editing become available when this page is interactive.

        Browser Python limits

        Python 3.13 with browser-compatible standard-library modules and prebundled SQLite, a 4-second execution limit, 16 KiB output and a 256 MiB Python heap cap. First loading can take up to 45 seconds. Total browser memory is browser-governed. No network, learner package installation, interactive input, host files or system processes. SQLite databases and temporary files disappear after each run. Platform-specific examples may report unsupported modules; download those for a suitable local environment.

        Change one thing; explain the difference.

        Allow another attempt.

        Try: Change budget to 4.

        The final decision becomes True; this changes policy, not durability.

        Use an unknown category.

        Try: Change the first kind to "unknown".

        Its decision becomes False rather than guessing that retry is safe.

        Before you move on

        A side effect commits, then its acknowledgment is lost. Does a three-attempt budget prevent duplication?

        Try explaining it in your own words. Running code is useful, but the explanation above gives you enough to reason it through first.

        Read a worked answer

        No. Even a second attempt can duplicate the effect. The effect boundary needs an idempotency or recovery protocol; the budget only limits how many attempts occur.

        This is a self-check, not a required quiz or a saved score. You can revisit any concept.

        Make the explanation your own.

        Use Save work and place to store notes with your code. Unsaved edits stay in this course tab; export before leaving. Reading milestones remain separate.

        Take a versioned study copy

        Export this lesson's original theory, textual model explanations, worked examples, public exercise checks and local-runtime boundaries for reading/review. This is separate from exporting your private workspace: no learner code, notes, identity, saved place or results are included. Offline server/browser execution is not provided.

        Worked examples and explained concept checkpoints remain included. Reference answers for independent work are excluded unless you explicitly select them. A downloaded answer is not an earned pass.

        REFLECT, THEN CONTINUE

        Make this a milestone.

        Save a self-reported core reading milestone and confidence. Confidence 1-3 schedules a review when none is already set; higher confidence does not create a new review. This is not a code execution pass or proof of mastery. Deep-dive reading is optional and is not tracked separately yet.

        Your account

        Loading account...

        Sign in to save your work across devices.