flowchart LR
learner["You write code"] --> file["Python instructions<br/>print('Hello')"]
file --> interpreter["Python interpreter"]
interpreter --> output["Output<br/>Hello"]
interpreter --> error["or error message<br/>if an instruction is unclear"]
What Is Programming?
Questions
- What problem does What Is Programming? help us solve in a small Python program?
- What should we predict before running the example?
- What value, output, or error should we inspect after changing one line?
Objectives
- Run a complete example for programming as precise instructions in Colab.
- Explain the example line by line using plain language.
- Change one part of the code and predict the result before running it.
- Recognize one common mistake and use the error message as evidence.
Hands-on episode: What Is Programming?
A program is a sequence of instructions; the interpreter reads those instructions and gives either output or feedback in the form of an error.
We will learn this by running code, not by memorizing a definition first. Open the Colab notebook from the button above, find this section, and run each cell in order. Keep a small note beside the notebook with three columns: prediction, actual result, and what changed.
Example 1.1
Start with a program that only talks. Before running it, predict how many lines of output you will see and in what order.
Run the cell once without editing it. If the result is different from your prediction, leave the prediction visible and write one sentence about the difference. That sentence is more useful than a perfect first guess.
Explain Example 1.1
- The first line calls
print, so Python displays the text between the quotes. - The second line is independent of the first; Python simply moves down to the next instruction.
- The third line runs last because programs normally run from top to bottom.
Now explain the example out loud or in a Markdown cell. Use short sentences: “this line creates…”, “this name stores…”, “this output appears because…”. If you cannot explain a line yet, run only the lines above it and inspect the values that exist at that moment.
Challenge 1.1
Change only the second line to print("Add coffee"). The first and third output lines should stay exactly the same. This tiny change proves that you can isolate one instruction and observe one effect.
Show a safe way to approach the challenge
- Copy Example 1.1 into a new Colab cell.
- Change exactly one value, name, condition, or line.
- Write the expected output before running the cell.
- Run the cell and compare the actual result with your prediction.
- If the result surprises you, undo the change and try a smaller one.
Suggested first move: Change only the second line to print("Add coffee").
Debugging checkpoint 1.1
The most common first mistake is a missing quote or parenthesis. When that happens, read the error as Python saying, ‘I could not understand the grammar here.’ Check the line mentioned in the message, then look one character to the left and right for an unmatched quote, parenthesis, or bracket.
Do not debug by rewriting the whole example. Read the error type or surprising output, inspect the closest value with print(...) or type(...), then change one thing. This is the same routine you will use in larger projects.
Apply it
In Colab, write three print lines for a task you know well: making breakfast, packing a bag, or starting a video call. Then intentionally break one quote, run the cell, read the error type, and fix only that one character.
Finish by adding a Markdown cell that answers: What did this example teach me that I can reuse in a project?
Key points
- Learn the concept by running a complete, small example first.
- Predict before execution so your thinking becomes visible.
- Change one thing at a time so cause and effect stay clear.
- Treat errors as clues about the exact line or value Python could not handle.
The problem this lesson solves
Before learning Python syntax, it helps to know what you are asking the computer to do. Programming is not magic and it is not memorizing hundreds of commands. Programming is writing clear instructions that a computer can follow.
A computer is powerful, but very literal. If a recipe says “add sugar” but does not say how much, a human cook may guess. Python will not guess. Python follows exactly what you wrote.
The basic idea
A program is a set of instructions. Python is one language for writing those instructions. The Python interpreter reads Python code, follows it step by step, and reports output or errors.
How Python runs instructions
The interpreter is the tool that turns your Python text into action.
When something goes wrong, the interpreter gives clues. Your job is to read the clue, make one small change, and try again.
Vocabulary in plain language
| Word | Beginner-friendly meaning |
|---|---|
| Program | Instructions written for a computer. |
| Code | The text of those instructions. |
| Python | A programming language with readable syntax. |
| Interpreter | The program that runs Python code. |
| Syntax | The spelling and grammar rules of a programming language. |
| Output | What the program displays or produces. |
| Error | Feedback that Python could not continue as written. |
You do not need to memorize this table immediately. Keep it nearby and return to it when the words appear in later lessons.
Example 1
Predict the output before running the code.
Step-by-step explanation
print("Make tea")printis a built-in Python function.- The parentheses contain the value we want to display.
- The quotes create a string, which is text.
- Python displays
Make tea.
print("Add honey")- Python moves to the next line.
- It displays
Add honeyon a new line.
print("Share with a friend")- Python displays the third string.
- The program then ends because there are no more instructions.
The output is:
Try changing one thing
Change exactly one string and run again:
What changed? Only the first output line. This is the learning loop you will use throughout the course: predict, run, compare, and explain.
A common first error
Broken code:
The opening quote has no matching closing quote. Python cannot tell where the text ends, so it raises a syntax error. Fix it by closing the string:
When an error appears, do not delete everything. Read the message, find the line, look for one small mismatch, and run again.
The beginner learning loop
Use this routine for every example in the course:
| Step | What to do | Why it helps |
|---|---|---|
| Read | Point to names, values, and symbols. | Slows the code down. |
| Predict | Write what you expect before running. | Makes your thinking visible. |
| Run | Execute the smallest complete example. | Lets Python give evidence. |
| Explain | Say what happened in plain language. | Turns output into understanding. |
| Modify | Change one small part and run again. | Shows cause and effect. |
| Debug | Read the clue and change one thing. | Builds confidence with errors. |
Check your understanding
Practice
Open https://colab.new and copy Example 1 into a code cell. Then make three small versions:
- print three steps for making a sandwich;
- print three lines that introduce yourself;
- intentionally remove one closing quote, run the cell, then fix it.
Key points
- A program is a precise set of instructions.
- Python is a programming language; the interpreter runs Python code.
print(...)displays output.- Strings are text surrounded by quotes.
- Errors are feedback, not failure.
- Learn by predicting, running, explaining, modifying, and debugging.
References
- Python Tutorial: https://docs.python.org/3/tutorial/
- Google Colab: https://colab.new