Part 1. Concepts and Context

Learning introductory concepts and context for AI-Assisted Coding.

Duration: 30 min


Learning objectives

By the end of this workshop, you will know:

  • Have a conceptual understanding of how LLMs work
  • Learn how to write clear intelligible prompts that AI tools respond to best
  • Understand the privacy risks inherent in LLMs like Copilot

Behind the Scene

Before we can get the most out of AI-assisted coding, it’s important to understand how the underlying models work. LLMs, like the ones powering coding assistants, process everything as tokens (short pieces of words or characters—not full words)….

flowchart LR
    A[Public code & docs<br/>model learned from] --> B[(LLM)]
    C[You share context<br/>snippets · errors · docs · chat] --> B
    B --> D[Better context]
    D --> E[Better answers<br/>draft · explain · fix]
    F[Your project] -.->|not seen unless you share it| B

Large language models (LLM) learned general coding patterns from huge amounts of public code and documentation online. That means that AI models are good at recognizing common syntax, coding libraries, and typical fixes in programming languages.

Every time you use a AI toolS (e.g. Copilot), the model works from the baseline information you share.

Your full project is not visible…

Better context leads to better answers; vague or missing context leads to generic or incomplete outputs…

add input/ouptu diagarm here…


The Prompt Formula

When asking AI to help with data, a clear prompt gives better results. A simple structure you can use is:

Context: What data do you have?
Task: What do you want to do?
Constraints: Any details or tools to use?
Format: How should the answer look?

You can remember it as: Context + Task + Constraints + Format

Let’s look at two ways to ask for help:

Bad (vague):

“Tell me about my penguin data.”

Better (simple and clear):

“I have a CSV file with penguin data. How many columns does it have? Show me the column names as a list.”

Why the better prompt works:

  • It tells the AI what data you’re working with (context)
  • States what you want to know (task)
  • Asks for a specific output (format)

You can build on this as you get more comfortable. For example, you might add a tool or a more specific task:

“I have penguins.csv. Using pandas, show me the average flipper length for each species as a table.”

Start simple!

  • Being specific helps, but you don’t need complex instructions
  • e.g. “How would you ask a person over the phone who has not seen your file?”

Quick Try-Out: What Would YOU Ask?

Let’s make this interactive!
Imagine you have a file called data/penguins.csv with penguin data.

Which prompt would you be most interested in trying?

Select one option:

  • A: Load data/penguins.csv with pandas and show me the first 5 rows and column names.
  • B: I have data/penguins.csv with penguin measurements. Use pandas to group by species and count how many in each. Show as a table.
  • C: Plot a histogram of flipper length for each species in data/penguins.csv using matplotlib.
  • D: Find any missing values in the penguins.csv data and tell me which columns have them.

Data — Palmer Penguins dataset

Preview of the data we’ll work with:

species island bill_length_mm bill_depth_mm flipper_length_mm body_mass_g sex year
Adelie Torgersen 39.1 18.7 181 3750 male 2007
Adelie Torgersen 39.5 17.4 186 3800 female 2007
Adelie Torgersen 40.3 18.0 195 3250 female 2007
Chinstrap Dream 46.5 17.9 192 3500 female 2007
Gentoo Biscoe 46.1 13.2 211 4500 female 2007

344 rows × 8 columns

Download dataset (CSV)

Source: Palmer Penguins

Artwork: Illustrations by @allison_horst

What about these promts them less effective?

  • “what’s in the file”
  • “analyze this”
  • “find errors”
  • “run pandas”
  • “missing values??”

Notice how these are vague or missing context. As you practice, try to avoid these and be clear about what you want!


Key Takeaways

  1. Be specific — the more detail, the better
  2. Be concise — don’t ramble
  3. State your format — say exactly what output you want (table, plot, list, etc.)
  4. Tools matter — when you want code, say which language or libraries you have in mind (e.g. pandas)—you can still practice the wording without installing anything

Resources


Next: 2. Data Analysis & Visualization


View in GitHub

Loading last updated date...