Learn to program, a problem-based approach (OER version)
කොටසේ දළ සටහන
-

It’s easier to learn how to program a computer today than it has ever been before. Now everyone can learn to write programs - no previous experience is necessary. All you need to learn how to program is a computer running a current browser and an Internet connection. Programming is a fun and interesting thing to learn, for the joy of creating new things.
Always start by reading the Notice board.
-
Computer programs have evolved from mathematics. But unlike in mathematics computer programs are written in pure text. As a result you have to write \( \frac{a}{2} \) or \( \sqrt{x + 1} \) as a/2 or sqrt(x + 1).
-
1.1 Quiz: Numerical expressions පැන විසදුම
-
1.2 Quiz: Expressions with variables පැන විසදුම
-
1.3 Recording of the live-session 1 යු ආර් එල්
-
1.4 Slides of the live-session 1 සම්පතක්
-
1.5 Quiz: Expanding expressions පැන විසදුම
-
1.6 Quiz: Revision පැන විසදුම
-
-
Programming is all about moving and transforming data. During this process you need to store information in "containers" to fetch them later. These containers are the variables. The assignment operator '=' assigns values to variables. To interact with the real world the programs also need mechanisms to read information, called input and a way to bring the results out, called output.
Language elements:
=|print|input|int|float -
The "programs" in unit 2 were linear; but real programs need to make decisions. Selection statements allow your code to branch off in different directions based on specific conditions. If a certain condition is met, the program does one thing; if not, it does something different.
Language elements:
if|elif|else|match|case-
3.4 Slides of live-session 4 සම්පතක්
-
Computers are famous for being able to do repetitive tasks without getting bored. Loops allow you to run the same block of code multiple times. Whether you want to repeat a task a set number of times (for loop) or keep going until a specific goal is reached (while loop), loops are the key to repetition.
-
As your code grows, it can become messy. Subprograms (also called Functions or Methods) allow you to group blocks of code together and separate them with an own name. This makes your code modular, easier to read, and allows you to reuse the same code throughout your program without rewriting.
-
-
Upload a soft copy of your handwritten summary before coming to the exam. The summary must contain your name and the sentence, "I made this document on my own, in my own handwriting." at the top.
The preferred format is PDF - not images (photos). We recommend CamScanner to make the PDFs.
For ideas on its usefulness, watch: The top 1% Think on Paper. Here’s How To Do It
-
Final exam, Retake පැන විසදුමOpens: සෙනසුරාදා, 18 ජූලි 2026, 11:59 PMවසා දමයි සඳුදා, 20 ජූලි 2026, 11:59 PM
-