What a program really is, how an interpreter turns your text into action, and why Python is the language the board chose for ICS.
01
Learning objectives
Define a program as a list of instructions executed in order.
Distinguish high-level languages from machine language, and interpreters from compilers.
State Python's key features: high-level, interpreted, general-purpose, free, readable.
Name real systems written in Python and describe where Python is used today.
Trace the path source code takes from file to output.
02
Lesson notes
A computer is fast but obedient to a fault: it does exactly what it is told, in the exact order it is told, and nothing else. A program is simply a list of instructions written in a language both a human and the machine can agree on. Write the list correctly and the computer multiplies matrices or streams a video; write it carelessly and it stops with an error. Learning to program is learning to think through that list so completely that even a machine with no common sense can follow it.
At the lowest level a processor executes machine language — raw binary numbers that are unreadable to humans. Nobody writes real applications in binary, so languages like Python are designed as high-level languages: they use English-like words (print, if, while) and ordinary mathematics, and one well-chosen line replaces dozens of machine instructions. High-level code is portable — the same Python file runs on Windows, Linux and macOS — while machine code is tied to one processor family.
Two kinds of translators bridge the gap. A compiler translates the whole program into machine code first, producing a file you can run later, and reports all its errors in one sweep before anything executes. An interpreter instead reads and executes your program statement by statement, so results appear immediately — and so a runtime error appears only when the faulty line is actually reached. Python is an interpreted language, which is why this website can run your code line by line inside the browser and show you output instantly.
Why did the Punjab board pick Python for ICS Part-1? Three reasons show up again and again in exam answers. First, readability: Python code looks close to plain English, so beginners spend their effort on logic instead of punctuation. Second, it is general-purpose — the same language builds websites, automates spreadsheets, trains AI models and analyses laboratory data. Third, it is free and open-source, with a huge standard library bundled so that simple programs need no downloads at all. Instagram, YouTube's backend, NASA's data pipelines and countless research labs all rely on it — Python is a professional tool that happens to be gentle enough for a first course.
Whenever you press Run — in IDLE, in VS Code or in the Nerdlyy playground below — the same chain fires: your source code (the .py text file) is handed to the Python interpreter, which executes it statement by statement and writes any results to the output console. Keep this pipeline in mind all year: it explains why a syntax error stops everything before line 1 runs, why a runtime error surfaces mid-program, and why the order of your lines is the order of your output.
03
Worked code examples
A complete, working Python program — three instructions
Three print instructions run top to bottom. The first two output text; the third evaluates the expression 2 + 3 and prints the result 5.
Assalam-o-Alaikum, Python!
I am learning ICS Computer Science.
5
The interpreter executes in order — one line at a time
Output order matches the line order exactly. If you rearranged the lines, the output would rearrange too — there is no magic, just top-to-bottom execution.
print("first")
print("second")
print("third")
Output
first
second
third
Comments: notes for humans, ignored by Python
Every line starting with # is a comment — Python skips it completely. Only the three non-comment lines execute, and the final line does the arithmetic.
# This program converts marks to a percentage.
# Written for the ICS Part-1 Python chapter.
obtained = 412 # total marks I scored
total = 550 # total marks offered
print(obtained / total * 100)
Output
74.90909090909092
04
Key terminology
program
A list of instructions that a computer executes in order to perform a task.
interpreter
A translator that reads and executes a program statement by statement, showing output immediately.
compiler
A translator that converts an entire program to machine code before any of it runs.
source code
The text of a program as the programmer wrote it, saved in a .py file for Python.
high-level language
A programming language with human-readable syntax that is independent of the processor, like Python.
05
Common misconceptions
Common mistake
The computer understands Python directly.
Correct understanding
The processor only understands machine language; the Python interpreter translates and executes your statements one by one.
Common mistake
Python must be compiled to an .exe before it can run.
Correct understanding
Python is interpreted — running a .py file works immediately, with no separate compilation step.
Common mistake
An interpreter reports every error before the program starts.
Correct understanding
That is the compiler's behaviour. The interpreter meets each error only when execution reaches that line.
06
Check your understanding
1. Which statement best describes how Python runs a program?
2. Which of these is NOT a reason Python was chosen for the ICS course?
3. A program has an error on line 4. When does an interpreter report it?