← Back to Chapter 1 Study Guide | ← Course Home Foundations & Checks

COMP9001 — Chapter 1 Supplement

Foundations & Quick Checks

A compact revision page for the key definitions, workflow, commands, and interpreter concepts introduced in Lecture 1.

Program Definition

Definition

A program is a set of instructions for a computer to execute in sequence to perform a certain task.

Which part of the definition makes order explicitly important?
“perform a certain task”
“execute in sequence”

Sequence and Logic

Lecture use of examples

Joining class or following a recipe works only when the actions are ordered correctly. The course uses these examples to introduce algorithmic thinking before code syntax.

Why are everyday instruction lists useful in an intro programming lecture?
They show that programming starts with precise step-by-step thinking
They replace the need to learn code entirely

Source Code Translation

Item
Term
Meaning
Text file
Source code
Human-readable program text written in a programming language
Binary execution form
Machine code
The form the hardware can actually execute
Whole program first
Compiler
Translates the source code before running
Line by line
Interpreter
Translates while the program is running
What is the lecture’s main distinction between a compiler and an interpreter?
A compiler translates the full program before running, while an interpreter translates during execution
Only one of them translates code at all

Tools and Commands

Command
Usage
Purpose
pwd
where am I?
Show the current directory
ls
view contents
List files and folders
mkdir
make directory
Create a folder
cd
change directory
Move to another location
touch
create file
Make a new file like hello.py
mv / cp
move / copy
Manage files

First Program Workflow

Three steps

1. Create a .py file. 2. Write code into the file. 3. Run the file.

Which step comes immediately after creating the file?
Write code into the file
Run the file immediately

Output and Interpreter

Built-in function

print() is introduced as a built-in function used for text output.

Python shell

Running python3 opens the interpreter, where code can be executed immediately and the results are shown right away.

Why is the interpreter useful for beginners?
It lets you try code immediately and inspect the result
It removes the need to learn Python syntax