BACK_TO_LEARN_LAB

Python 3 Study Guides

Structured, syllabus-aligned guides crafted for the Sri Lankan A/L ICT programming module. Read the theory, inspect clean exam-style syntax, and launch every example instantly in thePython Code Architect.

01#FUNDAMENTALS

Variables, Types & I/O

විචල්‍යයන්, දත්ත වර්ග සහ ආදාන/ප්‍රතිදාන

Master Python primitive types (int, float, str, bool), dynamic typing, type conversion with int() & float(), and interactive input() formatting for A/L ICT.

මූලික පයිතන් දත්ත වර්ග (int, float, str, bool), දත්ත වර්ග පරිවර්තනය (int(), float()), සහ interactive input() විධාන භාවිතය.

name = input("Student name: ")
age = int(input("Age: "))
gpa = float(input("GPA: "))
print(f"Candidate {name}, Age {age}: GPA={gpa:.2f}")
02#LOGIC_STRUCTURES

Control Flow & Conditionals

පාලන ව්‍යුහ සහ කොන්දේසි (if / elif / else)

Evaluate Boolean expressions using if, elif, and else. Understand comparison operators (==, !=, >, <) and logical operators (and, or, not) used in exam flowcharts.

if, elif, else භාවිතයෙන් බූලීය ප්‍රකාශන ඇගයීම. සංසන්දන ක්‍රියාකරක (==, !=, >, <) සහ තාර්කික ක්‍රියාකරක (and, or, not) භාවිතය.

marks = 78
if marks >= 75:
    grade = "A"
elif marks >= 65:
    grade = "B"
elif marks >= 50:
    grade = "C"
else:
    grade = "F"
print(f"Final Grade: {grade}")
03#ITERATION

Loops: while & for Iteration

පුනරාවර්තන සහ ලූප (for සහ while)

Understand deterministic iteration with for i in range(start, stop, step) and condition-driven loops with while. Learn break, continue, and accumulator patterns.

for i in range(start, stop, step) සහ කොන්දේසි මත පදනම් වූ while ලූප. break, continue සහ සමුච්චක (Accumulator) රටා.

total = 0
for i in range(1, 11):
    total += i
print(f"Sum of 1..10 = {total}")
04#DATA_STRUCTURES

Lists, Dictionaries & Sets

ලැයිස්තු (Lists), ශබ්දකෝෂ (Dicts) සහ කුලක (Sets)

Store and manipulate composite data collections: dynamic lists (append, pop, slice), key-value mapping dictionaries, and unique element sets.

සංයුක්ත දත්ත එකතු කළමනාකරණය: ලැයිස්තු (append, pop, slice), key-value සබඳතා සහිත Dictionaries, සහ අනන්‍ය අගයන් සහිත Sets.

scores = [85, 92, 78, 90]
scores.append(88)
avg = sum(scores) / len(scores)
print(f"Mean Score: {avg:.1f}")
05#MODULAR_PROGRAMMING

Functions, Scope & Returns

ශ්‍රිත සහ විචල්‍ය විෂය පථය (Functions & Scope)

Design reusable, structured code blocks with def, positional/keyword arguments, return statements, and local vs. global variable scope rules.

def භාවිතයෙන් නැවත භාවිත කළ හැකි කේත මොඩියුල නිර්මාණය, arguments, return ප්‍රකාශ සහ local vs global variable විෂය පථ නීති.

def compute_discount(price, rate=0.1):
    return price * (1 - rate)

final_price = compute_discount(1500, 0.15)
print(f"Payable: Rs. {final_price:.2f}")
06#ADVANCED_LOGIC

Nested Loops & Matrix Math

කූඩුගත ලූප සහ රටා නිර්මාණය (Nested Loops)

Master 2D row-column iterations, star pattern printing, and 2D matrix traversal frequently tested in Sri Lankan G.C.E. A/L ICT past papers.

ද්විමාන න්‍යාස සැරිසැරීම, තරු රටා මුද්‍රණය සහ උසස් පෙළ විභාගවල නිතර අසන Nested Loop ඇල්ගوریتම.

rows = 5
for i in range(1, rows + 1):
    print("*" * i)
EXPLORE_MORE_MODULES

Interactive ICT Labs & Knowledge Tracks