{
    "componentChunkName": "component---src-templates-course-content-template-js",
    "path": "/part-5/0-working-with-ai/",
    "result": {"data":{"page":{"htmlAst":{"type":"element","tagName":"div","properties":{},"children":[{"type":"element","tagName":"text-box","properties":{"variant":"learningObjectives","name":"Learning objectives"},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"After this section"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"You will recognize the three exercise modes used from Part 5 onward"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"You will know what remains your responsibility when an agent changes code"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"You will know what the pipeline stage labels on exercises mean"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"You will know how to inspect an agent's work in VS Code"}]},{"type":"text","value":"\n"}]}]},{"type":"element","tagName":"h2","properties":{"id":"a-new-way-of-working","style":"position:relative;"},"children":[{"type":"text","value":"A new way of working"},{"type":"element","tagName":"a","properties":{"href":"#a-new-way-of-working","ariaLabel":"a new way of working permalink","className":["anchor","after"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"In Parts 1–4, you wrote the exercises manually so that variables, conditions, loops, functions and data structures became building blocks you can recognize and combine. From Part 5 onward, you will still write code, but you will also practise reading existing implementations and working with a coding agent."}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"These later parts gradually increase the scale of what you can understand. Part 5 combines the fundamentals into transformations of in-memory records. Part 6 follows data through file-backed pipeline stages. Part 7 adds dataframe and analytical-library calls which perform larger operations. Part 8 returns to a complete application whose structure and modification you inspect with an agent."}]},{"type":"element","tagName":"h2","properties":{"id":"exercise-modes","style":"position:relative;"},"children":[{"type":"text","value":"Exercise modes"},{"type":"element","tagName":"a","properties":{"href":"#exercise-modes","ariaLabel":"exercise modes permalink","className":["anchor","after"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Every exercise from this point states its working mode using one of the following three names. The exercise instructions and pipeline-stage labels describe the particular kind of work; they are not additional modes."}]},{"type":"element","tagName":"h3","properties":{"id":"independent-practice","style":"position:relative;"},"children":[{"type":"text","value":"Independent practice"},{"type":"element","tagName":"a","properties":{"href":"#independent-practice","ariaLabel":"independent practice permalink","className":["anchor","after"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Implement the solution yourself, without asking an AI to generate or modify it. You may still use the course's AI tutor for conceptual help. These exercises preserve the short programming patterns you need in order to understand larger programs."}]},{"type":"element","tagName":"h3","properties":{"id":"code-review-and-repair","style":"position:relative;"},"children":[{"type":"text","value":"Code review and repair"},{"type":"element","tagName":"a","properties":{"href":"#code-review-and-repair","ariaLabel":"code review and repair permalink","className":["anchor","after"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Read supplied or previously written code, predict its behaviour, locate a specific defect and make a constrained correction. You may ask an agent to explain the code unless the exercise says otherwise, but you make the correction yourself and inspect the result."}]},{"type":"element","tagName":"h3","properties":{"id":"agent-assisted-change","style":"position:relative;"},"children":[{"type":"text","value":"Agent-assisted change"},{"type":"element","tagName":"a","properties":{"href":"#agent-assisted-change","ariaLabel":"agent assisted change permalink","className":["anchor","after"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Ask the coding agent in VS Code to implement the requested change. You are responsible for understanding what it changed well enough to decide whether the code actually implements the request. Some exercises then ask you to make or direct a further change."}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"If generated code remains in a submitted exercise, add "},{"type":"element","tagName":"code","properties":{"className":["language-text"]},"children":[{"type":"text","value":"# used AI"}]},{"type":"text","value":" as its first line. The label records the working method; it does not replace understanding."}]},{"type":"element","tagName":"h2","properties":{"id":"pipeline-stage-labels","style":"position:relative;"},"children":[{"type":"text","value":"Pipeline stage labels"},{"type":"element","tagName":"a","properties":{"href":"#pipeline-stage-labels","ariaLabel":"pipeline stage labels permalink","className":["anchor","after"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Most exercises from this point also carry a "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Pipeline stage(s)"}]},{"type":"text","value":" label. These name the parts of a data flow the exercise touches, using a vocabulary the rest of the course reuses:"}]},{"type":"text","value":"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"},{"type":"element","tagName":"table","properties":{},"children":[{"type":"element","tagName":"thead","properties":{},"children":[{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"Stage"}]},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"What happens"}]}]}]},{"type":"element","tagName":"tbody","properties":{},"children":[{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Ingest"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Data enters the program from outside it: a file, an API response or another external source."}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Validate"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Records are checked against the shape and types the rest of the program expects, and unusable ones are rejected."}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Transform"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Values are reshaped, derived, joined or filtered into the form later stages need."}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Summarize"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Many records are combined into counts, totals, groups or other aggregate results."}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Present"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"A verified result becomes output: printed rows, a written file, a table or a chart."}]}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Not every program has all five, and a small one may do several of them in a single function. The labels are a reading aid rather than a required structure. They tell you which part of a data flow an exercise practises, and they give you vocabulary for telling an agent precisely which stage you want changed."}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"In Part 5 the data is already in memory, so these exercises begin at "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Validate"}]},{"type":"text","value":" or "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Transform"}]},{"type":"text","value":". Part 6 adds "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Ingest"}]},{"type":"text","value":" and "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Present"}]},{"type":"text","value":" across file boundaries, and Part 7 hands some of the middle stages to analytical libraries."}]},{"type":"element","tagName":"h2","properties":{"id":"working-with-an-agent","style":"position:relative;"},"children":[{"type":"text","value":"Working with an agent"},{"type":"element","tagName":"a","properties":{"href":"#working-with-an-agent","ariaLabel":"working with an agent permalink","className":["anchor","after"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]}]},{"type":"element","tagName":"h3","properties":{"id":"ask-for-the-change","style":"position:relative;"},"children":[{"type":"text","value":"Ask for the change"},{"type":"element","tagName":"a","properties":{"href":"#ask-for-the-change","ariaLabel":"ask for the change permalink","className":["anchor","after"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Tell the agent what you want changed and point it to the relevant exercise files. Include constraints or examples which matter to the task. A focused request such as “add filtering by department while preserving the original row order” is more useful than “improve this program.”"}]},{"type":"element","tagName":"h3","properties":{"id":"understand-what-it-did","style":"position:relative;"},"children":[{"type":"text","value":"Understand what it did"},{"type":"element","tagName":"a","properties":{"href":"#understand-what-it-did","ariaLabel":"understand what it did permalink","className":["anchor","after"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"When the agent finishes, use its explanation to find your way around, then inspect the code itself. For a modification, begin with the change view or diff and open enough surrounding code to understand how the changed values are used."}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Depending on the task, follow questions such as these through the actual code:"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"Where does the relevant data enter this function or program?"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"Which condition, loop or library call implements the requested change?"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"What values or data structures exist before and after it?"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"Which functions, outputs or displays receive the changed result?"}]},{"type":"text","value":"\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Run the program or the supplied checks while tracing those paths, and inspect relevant output values. The purpose is not to perform a separate testing ritual after every change. It is to use the code and its behaviour together to understand what the agent actually did and whether that supports accepting the change."}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"If something remains unclear, ask the agent to walk through the relevant code with concrete values. Then compare that explanation with the lines, callers and results it refers to. In exercises which request a follow-up change, use this understanding to decide where that change belongs and what else it should affect."}]},{"type":"element","tagName":"h2","properties":{"id":"return-to-the-coding-agent","style":"position:relative;"},"children":[{"type":"text","value":"Return to the coding agent"},{"type":"element","tagName":"a","properties":{"href":"#return-to-the-coding-agent","ariaLabel":"return to the coding agent permalink","className":["anchor","after"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"You installed and tried Copilot in "},{"type":"element","tagName":"a","properties":{"href":"/programming-digital-humanities/part-0"},"children":[{"type":"text","value":"Part 0"}]},{"type":"text","value":", and then turned its code-generation features off for Parts 1–4. Turn Copilot back on from its menu in the VS Code status bar for the non-independent practice exercises. Open the Chat or Agents view, select "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Agent"}]},{"type":"text","value":" mode and keep the relevant exercise folder open as your workspace."}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The exercises will tell you when generated changes are part of the intended working mode. Copilot may also offer grey autocomplete suggestions as you type; press "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Tab"}]},{"type":"text","value":" to accept one or "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Esc"}]},{"type":"text","value":" to reject it, and read accepted code just as you read code produced in chat."}]}]},"html":"<div><text-box variant='learningObjectives' name=\"Learning objectives\"><p>After this section</p><ul>\n<li>You will recognize the three exercise modes used from Part 5 onward</li>\n<li>You will know what remains your responsibility when an agent changes code</li>\n<li>You will know what the pipeline stage labels on exercises mean</li>\n<li>You will know how to inspect an agent's work in VS Code</li>\n</ul></text-box><h2 id=\"a-new-way-of-working\" style=\"position:relative;\">A new way of working<a href=\"#a-new-way-of-working\" aria-label=\"a new way of working permalink\" class=\"anchor after\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a></h2><p>In Parts 1–4, you wrote the exercises manually so that variables, conditions, loops, functions and data structures became building blocks you can recognize and combine. From Part 5 onward, you will still write code, but you will also practise reading existing implementations and working with a coding agent.</p><p>These later parts gradually increase the scale of what you can understand. Part 5 combines the fundamentals into transformations of in-memory records. Part 6 follows data through file-backed pipeline stages. Part 7 adds dataframe and analytical-library calls which perform larger operations. Part 8 returns to a complete application whose structure and modification you inspect with an agent.</p><h2 id=\"exercise-modes\" style=\"position:relative;\">Exercise modes<a href=\"#exercise-modes\" aria-label=\"exercise modes permalink\" class=\"anchor after\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a></h2><p>Every exercise from this point states its working mode using one of the following three names. The exercise instructions and pipeline-stage labels describe the particular kind of work; they are not additional modes.</p><h3 id=\"independent-practice\" style=\"position:relative;\">Independent practice<a href=\"#independent-practice\" aria-label=\"independent practice permalink\" class=\"anchor after\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a></h3><p>Implement the solution yourself, without asking an AI to generate or modify it. You may still use the course's AI tutor for conceptual help. These exercises preserve the short programming patterns you need in order to understand larger programs.</p><h3 id=\"code-review-and-repair\" style=\"position:relative;\">Code review and repair<a href=\"#code-review-and-repair\" aria-label=\"code review and repair permalink\" class=\"anchor after\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a></h3><p>Read supplied or previously written code, predict its behaviour, locate a specific defect and make a constrained correction. You may ask an agent to explain the code unless the exercise says otherwise, but you make the correction yourself and inspect the result.</p><h3 id=\"agent-assisted-change\" style=\"position:relative;\">Agent-assisted change<a href=\"#agent-assisted-change\" aria-label=\"agent assisted change permalink\" class=\"anchor after\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a></h3><p>Ask the coding agent in VS Code to implement the requested change. You are responsible for understanding what it changed well enough to decide whether the code actually implements the request. Some exercises then ask you to make or direct a further change.</p><p>If generated code remains in a submitted exercise, add <code class=\"language-text\"># used AI</code> as its first line. The label records the working method; it does not replace understanding.</p><h2 id=\"pipeline-stage-labels\" style=\"position:relative;\">Pipeline stage labels<a href=\"#pipeline-stage-labels\" aria-label=\"pipeline stage labels permalink\" class=\"anchor after\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a></h2><p>Most exercises from this point also carry a <strong>Pipeline stage(s)</strong> label. These name the parts of a data flow the exercise touches, using a vocabulary the rest of the course reuses:</p><table>\n<thead>\n<tr>\n<th>Stage</th>\n<th>What happens</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><strong>Ingest</strong></td>\n<td>Data enters the program from outside it: a file, an API response or another external source.</td>\n</tr>\n<tr>\n<td><strong>Validate</strong></td>\n<td>Records are checked against the shape and types the rest of the program expects, and unusable ones are rejected.</td>\n</tr>\n<tr>\n<td><strong>Transform</strong></td>\n<td>Values are reshaped, derived, joined or filtered into the form later stages need.</td>\n</tr>\n<tr>\n<td><strong>Summarize</strong></td>\n<td>Many records are combined into counts, totals, groups or other aggregate results.</td>\n</tr>\n<tr>\n<td><strong>Present</strong></td>\n<td>A verified result becomes output: printed rows, a written file, a table or a chart.</td>\n</tr>\n</tbody>\n</table><p>Not every program has all five, and a small one may do several of them in a single function. The labels are a reading aid rather than a required structure. They tell you which part of a data flow an exercise practises, and they give you vocabulary for telling an agent precisely which stage you want changed.</p><p>In Part 5 the data is already in memory, so these exercises begin at <strong>Validate</strong> or <strong>Transform</strong>. Part 6 adds <strong>Ingest</strong> and <strong>Present</strong> across file boundaries, and Part 7 hands some of the middle stages to analytical libraries.</p><h2 id=\"working-with-an-agent\" style=\"position:relative;\">Working with an agent<a href=\"#working-with-an-agent\" aria-label=\"working with an agent permalink\" class=\"anchor after\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a></h2><h3 id=\"ask-for-the-change\" style=\"position:relative;\">Ask for the change<a href=\"#ask-for-the-change\" aria-label=\"ask for the change permalink\" class=\"anchor after\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a></h3><p>Tell the agent what you want changed and point it to the relevant exercise files. Include constraints or examples which matter to the task. A focused request such as “add filtering by department while preserving the original row order” is more useful than “improve this program.”</p><h3 id=\"understand-what-it-did\" style=\"position:relative;\">Understand what it did<a href=\"#understand-what-it-did\" aria-label=\"understand what it did permalink\" class=\"anchor after\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a></h3><p>When the agent finishes, use its explanation to find your way around, then inspect the code itself. For a modification, begin with the change view or diff and open enough surrounding code to understand how the changed values are used.</p><p>Depending on the task, follow questions such as these through the actual code:</p><ul>\n<li>Where does the relevant data enter this function or program?</li>\n<li>Which condition, loop or library call implements the requested change?</li>\n<li>What values or data structures exist before and after it?</li>\n<li>Which functions, outputs or displays receive the changed result?</li>\n</ul><p>Run the program or the supplied checks while tracing those paths, and inspect relevant output values. The purpose is not to perform a separate testing ritual after every change. It is to use the code and its behaviour together to understand what the agent actually did and whether that supports accepting the change.</p><p>If something remains unclear, ask the agent to walk through the relevant code with concrete values. Then compare that explanation with the lines, callers and results it refers to. In exercises which request a follow-up change, use this understanding to decide where that change belongs and what else it should affect.</p><h2 id=\"return-to-the-coding-agent\" style=\"position:relative;\">Return to the coding agent<a href=\"#return-to-the-coding-agent\" aria-label=\"return to the coding agent permalink\" class=\"anchor after\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a></h2><p>You installed and tried Copilot in <a href=\"/programming-digital-humanities/part-0\">Part 0</a>, and then turned its code-generation features off for Parts 1–4. Turn Copilot back on from its menu in the VS Code status bar for the non-independent practice exercises. Open the Chat or Agents view, select <strong>Agent</strong> mode and keep the relevant exercise folder open as your workspace.</p><p>The exercises will tell you when generated changes are part of the intended working mode. Copilot may also offer grey autocomplete suggestions as you type; press <strong>Tab</strong> to accept one or <strong>Esc</strong> to reject it, and read accepted code just as you read code produced in chat.</p></div>","frontmatter":{"path":"/part-5/0-working-with-ai/","title":"Working with AI from Part 5 onward"},"fileAbsolutePath":"/home/runner/work/programming-digital-humanities/programming-digital-humanities/data/part-5/0-working-with-ai.md"},"allPages":{"edges":[{"node":{"id":"5d899565-03f0-55ea-8073-4ee194950c4d","frontmatter":{"path":"/ai-tutor/","title":"Using the AI tutor on the course"}}},{"node":{"id":"c6198176-c061-5cca-a182-cc80cdb14e38","frontmatter":{"path":"/all-exercises/","title":"All exercises"}}},{"node":{"id":"6c2bb78f-1497-5d72-a964-8cb55e47559e","frontmatter":{"path":"/error_messages/","title":"Common error messages"}}},{"node":{"id":"96430bcf-4526-5d85-9206-c7336a6be270","frontmatter":{"path":"/faq/","title":"Frequently asked questions"}}},{"node":{"id":"0d6f8da4-7d4f-5228-a832-7ff574e63570","frontmatter":{"path":"/frontmatter-guide","title":"Frontmatter-guide"}}},{"node":{"id":"249c8a64-20fb-510c-8b3e-f5b3b72fe028","frontmatter":{"path":"/grading/","title":"Grading"}}},{"node":{"id":"5b5e6522-0d23-577b-9ba9-4ecd1c1c5d24","frontmatter":{"path":"/","title":"About this course"}}},{"node":{"id":"bcdb2bdc-e92c-5c75-8dd1-13f57e1129da","frontmatter":{"path":"/glossary","title":"Glossary"}}},{"node":{"id":"d54c2afb-004d-500e-9d19-aa3d154a39a5","frontmatter":{"path":"/part-0/","title":"Part 0: See what an agent can build"}}},{"node":{"id":"fff8e65b-0281-55fe-a21a-9e7e872ddc33","frontmatter":{"path":"/part-1/1-getting-started/","title":"Getting started"}}},{"node":{"id":"9fa0a7fc-c673-56ad-9dc8-bf6aeb6d3b05","frontmatter":{"path":"/part-1/2-information-from-the-user/","title":"Information from the user"}}},{"node":{"id":"c2286d4a-4cf7-5fc4-ab0f-f7cd2acf49df","frontmatter":{"path":"/part-1/3-more-about-variables/","title":"More about variables"}}},{"node":{"id":"3ebadf79-0e16-5ed7-bcb2-bec3731cffc2","frontmatter":{"path":"/part-1/4-arithmetic-operations/","title":"Arithmetic operations"}}},{"node":{"id":"c77004ff-fe4d-5533-b77f-c861fa42430d","frontmatter":{"path":"/part-1/5-conditional-statements/","title":"Conditional statements"}}},{"node":{"id":"50ee91dc-7fe8-508d-940f-577449a335f4","frontmatter":{"path":"/part-1/","title":"Part 1"}}},{"node":{"id":"d963c6b4-b2d4-59ff-b310-265b28e2c8d2","frontmatter":{"path":"/part-2/1-programming-terminology/","title":"Programming terminology"}}},{"node":{"id":"075f597d-a49f-59c1-ad1a-d68ba19aa0f4","frontmatter":{"path":"/part-2/2-else-elif/","title":"More conditionals"}}},{"node":{"id":"26776fa9-27c7-5554-990b-09d6661a07a8","frontmatter":{"path":"/part-2/3-combining-conditions/","title":"Combining conditions"}}},{"node":{"id":"1da4e234-e81f-5494-b2d4-96e30cbb4464","frontmatter":{"path":"/part-2/4-simple-loops/","title":"Simple loops"}}},{"node":{"id":"db78d781-f405-5904-91bf-e96f7f04353f","frontmatter":{"path":"/part-2/","title":"Part 2"}}},{"node":{"id":"10808e92-b68f-58c3-b767-cf5e9c0efeb7","frontmatter":{"path":"/part-3/1-loops-with-conditions/","title":"Loops with conditions"}}},{"node":{"id":"bceed420-a129-52a7-81ed-dafd67ad38df","frontmatter":{"path":"/part-3/2-working-with-strings/","title":"Working with strings"}}},{"node":{"id":"e2dfd9d3-07fa-59a0-b748-370355606256","frontmatter":{"path":"/part-3/3-more-loops/","title":"More loops"}}},{"node":{"id":"5b546d28-ac00-564f-9d75-cc09c4382b64","frontmatter":{"path":"/part-3/4-defining-functions/","title":"Defining functions"}}},{"node":{"id":"12122cff-c09e-53f1-8b76-8517f845e08c","frontmatter":{"path":"/part-3/","title":"Part 3"}}},{"node":{"id":"8fbb5845-152f-5be7-ac92-fa280093b2a2","frontmatter":{"path":"/part-4/1-vscode/","title":"The Visual Studio Code editor, Python interpreter and built-in debugging tool"}}},{"node":{"id":"b8d090a9-7e49-5ab7-a5a1-d126179dd9a0","frontmatter":{"path":"/part-4/2-more-functions/","title":"More functions"}}},{"node":{"id":"271308ca-b267-5c86-8051-8a1a3480cfcb","frontmatter":{"path":"/part-4/3-lists/","title":"Lists"}}},{"node":{"id":"e5a8fd16-890d-509e-9666-9c622648c18a","frontmatter":{"path":"/part-4/4-definite-iteration/","title":"Definite iteration"}}},{"node":{"id":"ca4caea3-eaad-5cc3-a1fa-83b9bb90a25e","frontmatter":{"path":"/part-4/5-strings-and-lists/","title":"More strings and lists"}}},{"node":{"id":"adeebce2-76be-5528-90a1-6feaa066fcd8","frontmatter":{"path":"/part-4/6-data-structures/","title":"Data structures and data shapes"}}},{"node":{"id":"07e761ca-39a1-50a1-97d8-9149e4737e89","frontmatter":{"path":"/part-4/","title":"Part 4"}}},{"node":{"id":"80fe5d23-31eb-5ff6-b339-99e173e9279f","frontmatter":{"path":"/part-5/0-working-with-ai/","title":"Working with AI from Part 5 onward"}}},{"node":{"id":"111a6af4-b8a7-5d71-8966-f750f6c161a6","frontmatter":{"path":"/part-5/1-tables-as-nested-lists/","title":"Tables as nested lists"}}},{"node":{"id":"7e2cf429-03ea-5e8c-86ce-62c71c689a75","frontmatter":{"path":"/part-5/2-references/","title":"References and transformed results"}}},{"node":{"id":"3901dc36-3116-5444-9120-6b38454e245f","frontmatter":{"path":"/part-5/3-grouping-and-structured-records/","title":"Grouping and structured records"}}},{"node":{"id":"076a1db2-8d62-5725-ad72-c43ea25897c6","frontmatter":{"path":"/part-5/4-small-database/","title":"Building a small database"}}},{"node":{"id":"cf823ebf-3d67-53ca-8fcf-9b53fee10c1d","frontmatter":{"path":"/part-5/5-in-memory-analysis-pipeline/","title":"An in-memory analysis pipeline"}}},{"node":{"id":"92cbc670-d401-53b8-949f-9725b81a5e4a","frontmatter":{"path":"/part-5/","title":"Part 5"}}},{"node":{"id":"52ecf5a7-9266-58c8-bac5-407b1a29a9dd","frontmatter":{"path":"/part-6/2-writing-files/","title":"Writing and exporting files"}}},{"node":{"id":"a296984d-7503-558e-86da-ddb801f8a59b","frontmatter":{"path":"/part-6/3-scope-of-variables/","title":"Make data flow explicit"}}},{"node":{"id":"98bdbc42-0ebc-5f9c-b767-b987266a0040","frontmatter":{"path":"/part-6/4-modules/","title":"Use existing libraries"}}},{"node":{"id":"0ca5c730-bd8e-5099-9768-8fcb8eb0b7b4","frontmatter":{"path":"/part-6/1-reading-files/","title":"Reading files"}}},{"node":{"id":"11759056-5a15-5820-a693-30f4df62f118","frontmatter":{"path":"/part-6/","title":"Part 6"}}},{"node":{"id":"6e748518-2c76-5428-8779-0f0455b17a0d","frontmatter":{"path":"/part-7/0-dataframes-and-views/","title":"Working with pandas dataframes"}}},{"node":{"id":"047a5114-7ebb-5a5c-8ed0-eadf81564546","frontmatter":{"path":"/part-7/1-times-and-dates/","title":"Times and dates"}}},{"node":{"id":"7cc9d1d2-fb68-52da-b5ec-034bf9f4585f","frontmatter":{"path":"/part-7/3-more-features/","title":"More Python features"}}},{"node":{"id":"5055044d-7938-5e5d-be5c-dfb0ff2c81b4","frontmatter":{"path":"/part-7/2-data-processing/","title":"Data processing"}}},{"node":{"id":"cea3f325-56bb-5a93-885e-275e465c1ced","frontmatter":{"path":"/part-7/","title":"Part 7"}}},{"node":{"id":"3abea309-839b-562f-bb00-3be40d963200","frontmatter":{"path":"/part-8/","title":"Part 8"}}}]}},"pageContext":{}},
    "staticQueryHashes": ["1357757885","994120085"]}