Course materials · AI Applications

Explain your thinking with a Notebook

English translation

AI Applications Week 2 · Concepts and exercise instructions

Today's goal is to run code and explain what it does so others can understand. Learn Colab and Markdown while creating a small Notebook on an AI topic of interest.

After watching the video, you may start with sections you remember less clearly. Hover over or click underlined terms to see definitions. Expand detailed examples, and try answering check questions yourself first.

Required: A Google account and web browser. This exercise requires no GPU or paid service.

Clicking the button opens this exercise Notebook in a new tab. Sign in to Google if needed, confirm creation of a copy, and work in your Drive. You can start without downloading and uploading files.

1. Why do we need both programming and explanation?

Repeating computations by hand takes time and invites mistakes. A program expresses a human-defined procedure for a computer to repeat. Decide what you want the computer to do before writing code.

To illustrate the relationship between explanation, code, and results, calculate the mean of three temperature measurements.

Decide first Choices in this example
Input Temperature measurements 20, 22, 24
Processing Sum the three values and divide by the measurement count
Output Mean temperature 22
readings = [20, 22, 24]
average = sum(readings) / len(readings)
print(average)  # 22.0

readings is a list of measurements. sum computes their sum, and len their count. You need not memorize the function names yet. See how the code corresponds to the computation defined earlier.

This distinction also matters when using AI. For example, speech recognition takes speech as input and outputs text. Saying only “use AI” does not adequately explain the problem. In this report too, specify the input and result of your chosen technology.

NoteThink first

If only 22.0 remains from running the code above, can you tell what was averaged? What one-sentence explanation would you add below the result?

View suggested response approach

For example, “The mean of three temperature measurements, 20, 22, and 24, is 22” shows the relationship between inputs and results. In this exercise too, keep execution results in Code Cells and explain their meaning in the Text Cells immediately below.

2. Roles of Notebook, Colab, and Drive

A Notebook is a document, Colab is an execution environment, and Drive stores files. Saving a document differs from retaining variables in a running session.

A Notebook is a document containing explanations and execution

A Notebook's file extension is .ipynb. The document contains multiple cells, each with a role. Reading and running cells from the top lets you record an experiment's process.

Colab is an environment for opening Notebooks and running Python code in a browser. Google Drive stores Notebook files. Code runs on a computer provided by Google, called the runtime.

Category What does it contain? Remember
Notebook file Explanations, code, and saved outputs Document to save in Drive
Runtime Active variables, installed packages, and temporary files State may disappear when the connection ends
Drive Saved Notebooks and personal files Storage is separate from the runtime

Saving a Notebook to Drive differs from connecting personal files to the runtime with drive.mount(). This exercise does not read personal files, so Drive mounting code is unnecessary. GPU settings need not change either.

What to check when first opening the file
  1. Check that you are signed in to Google.
  2. Open the provided Notebook and save a copy to your Drive.
  3. Rename the file to Name_StudentID_Week2.ipynb.
  4. Run the topmost executable cell first. Use the run button or Shift + Enter.
  5. Check that results appear and that the file is saved.
Check: Does seeing yesterday's output mean today's execution is complete?

No. Output on screen may have been saved from an earlier run. The current runtime may lack the variables from that run. Rerun from the top to verify that the current state produces the results.

3. Cells for explanation and cells for execution

Use a Markdown Cell (a Text Cell in Colab) for explanations. Use a Code Cell for executable Python code.

Where should the same content be written? Result
Write print(1 + 1) in a Markdown cell Code is displayed as text
Write print(1 + 1) in a Code cell and run it Computed result 2 is printed

Enclosing code in triple backticks in Markdown displays it neatly but does not execute it.

```python
print(1 + 1)
```

This distinction is useful for reports. Keep execution results in Code cells and explain their meaning in the Markdown cells immediately below.

Check: If code appears only as text, what should you check first?

Check the cell type. If the code is in an explanatory Text Cell, move it to a Code Cell and run it. Check the execution location before changing the computation itself.

4. Structure a document with Markdown

Structure documents with simple symbols such as # Heading, **Emphasis**, and - List. Practice includes checking how they render after entering the symbols.

Headings show relationships between content

#, ##, and ### indicate heading levels. Think of them as showing relationships between broader topics and subtopics, rather than simply changing font size. Add a space after the marker.

# Speech Recognition
## What problem does it solve
### Converting speech to text

This assignment requires at least 3 heading levels. Choose headings suited to your topic rather than copying the example above.

Emphasis and lists
**Important terms** appear in bold.
*Words needing special emphasis* can appear in italics.
Write function or variable names like `print`.

- Speech data
- Text data
- Image data

1. Prepare the input.
2. Process it.
3. Check the results.

Use numbered lists when order matters and bulleted lists to group items. A blank line is the clearest way to separate paragraphs. To force a line break within a paragraph, you can use two spaces at the end of a line.

Short quotations and code formatting
> This is a quotation or an explanation to emphasize.

Enclose a one-line function name in single backticks and a multiline code example in triple backticks. The backtick is a different keyboard symbol from the single quotation mark.

Check: What is wrong with ##Topic and **Description*?

A space is missing after the heading marker, and the bold markers have unequal lengths on either side. Correct them to ## Topic and **Description** and check how they render. Alternating between syntax and rendered views is a useful habit.

5. Figures, tables, and equations support explanations

First decide what to show or compare, then choose a suitable representation. Add sentences explaining the meaning of images, equations, and links.

Links and images
[Resource name](https://example.org)
![What the image shows](actual_image_URL)

The two syntaxes differ in the leading !. The example.org and image address above are placeholders showing the format. Choose actual resources relevant to your topic for the assignment.

Explain what the image shows and how it relates to your chosen AI technology. For links, explain why you selected them or what the page contains. A private Drive image address may prevent others from seeing the image when they open the document.

Choose comparison criteria before building a table

Tables are easier to compare when each column contains the same kind of information. The following is an example for practicing syntax.

| Item | Input | Result |
|---|---|---|
| Calculate the mean | Multiple numbers | Mean |
| Sort | Unordered numbers | Numbers in sorted order |
Item Input Result
Calculate the mean Multiple numbers Mean
Sorting Numbers in mixed order Numbers in ascending order

The second line separates the header from the data. The header does not count as a data row. This assignment requires at least 3 columns and 4 data rows. The practice table above has too few rows and is not a completed AI topic report.

Explain symbols used in equations

For example, the mean computed earlier can be expressed as follows.

x‾=1N∑i=1Nxi \bar{x}=\frac{1}{N}\sum_{i=1}^{N}x_i

N is the number of values, xᵢ is the ith value, and x̄ is the mean. For 20, 22, and 24, N=3, and the mean is 22. When reading an equation, connect symbols → concrete values → computed result.

$$
\bar{x}=\frac{1}{N}\sum_{i=1}^{N}x_i
$$

Colab Markdown cells can display equations using LaTeX syntax as shown here. This assignment requires at least 2 equations, each with an explanation of its meaning. Choose equations you can explain rather than complex ones.

Check: If a table has one header row and three data rows, does it meet the 4-row requirement?

No. The assignment requires 4 data rows. Inserting figures or equations alone also does not complete the assignment; explanations of what they represent are required.

6. Essential syntax for reading Python code

Store values in variables, execute statements in order, and inspect results. Expand only the syntax you need below.

Variables and output

A variable is a name assigned to a value. = stores the value computed on the right under the name on the left.

count = 4
print(count)
print(f"항목 수: {count}")

The first output is 4, and the second is 항목 수: 4. As in the second line, print displays a value. f"...{count}..." inserts variable values into a sentence. f-strings make sentences containing variable values easier to read.

Comments and strings
# This line is an explanatory comment.
message = "실습 시작"
print(message)

Content after # is a comment that is not executed on that line. Text enclosed in quotation marks is a string, a text value.

Triple quotes also create strings. Supporting multiple lines does not make them dedicated comment syntax. Used as the first statement of a function or similar definition, they can form a docstring. Distinguish multiline strings from comments.

Indentation defines code scope
ready = True
if ready:
    print("준비가 되었습니다")
print("이 줄은 if 바깥입니다")

Indented lines execute when ready is true. The last line is outside if and executes regardless of the condition. Here, use 4 spaces without mixing tabs and spaces.

Input initially arrives as a string
text = input("숫자를 입력하세요: ")
number = float(text)
print(number + 1)

Even when entering 3 with input(), the initial value is the string "3". Convert it using float or int for numerical computations. Converting nonnumeric text may cause an error. The designated code in the submission Notebook runs without an input prompt, so this example is for understanding syntax.

Check: Are “3” + “1” and 3 + 1 the same?

Adding strings yields "31", while adding numbers yields 4. Values that look similar on screen behave differently when their types differ. If a result is unexpected, check the type using type(value).

7. Checks when execution gets stuck

Symptom Check first
Code appears only as text Whether the cell type is Code
NameError Whether the earlier cell creating the variable was run, and whether spelling matches
IndentationError Whether indentation levels and spaces are consistent
TypeError Whether different types, such as text and numbers, were mixed
Tables or emphasis render incorrectly Markdown separator lines, matching symbols, and spaces

When an error occurs, first read the error name on the last line and the problematic code line. Change one thing and check again rather than editing many lines at once. Even if outputs already remain, running cells in order from the top reveals dependencies between cells.

8. Now write about your own AI topic

Open the practice Notebook in Colab ↗ includes starting instructions, a small execution check, report response fields, and an error-correction exercise. Fill the blanks with your own topic and remove hint text before submission. Follow the teaching assistant's exercise instructions.

View detailed current assignment requirements

The current assignment requires the following.

  • At least 3 heading levels, and at least 1 use each of bold, italics, and inline code.
  • At least 3 items each in ordered and bulleted lists. The AI processing ordered list requires at least 4 stages.
  • Introduce the AI technology in 3–5 sentences: technology, data, problem, and uses.
  • At least 1 image and 1–2 explanatory sentences.
  • Table with at least 3 columns and 4 data rows.
  • At least 2 equations, each with at least 1 sentence explaining its meaning.
  • At least 1 related link and 1–2 sentences on the reason for selecting it or its content.
  • Run the designated Code Cell, explain at least 2 cell differences, and fix Markdown errors.

References

Materials version: 2026-2-02 · Reference date: 2026-09-10

Practice materials