Dr.
Arosha Mediwake
ICTBUS Academy
1|Page D r. A r o s h a M e d i w a k e
Activity 1: Build Your First Python Program
Task:
Create a simple Python program:
“Student Introduction Program”
name = input("Enter your name: ")
age = input("Enter your age: ")
print("Hello", name)
print("You are", age, "years old")
Skills Covered:
• Using IDE (Run, Save)
• Input / Output
• Variables
Extension:
Add favorite subject
Activity 2: Operators Game
(Covers: Operators – 9.7)
Task:
Students predict output first, then run code.
a = 10
b=3
print(a + b)
print(a > b)
print(a % b)
2|Page D r. A r o s h a M e d i w a k e
Activity: Flowchart Drawing Challenge
(Covers: Algorithms, flowcharts – 9.3)
Task:
Draw a flowchart for:
“Check if a number is even or odd”
Steps:
1. Start
2. Input number
3. Check number % 2
4. Display result
5. End
Output:
✔ Flowchart diagram
✔ Identify symbols (Start, Process, Decision)
Activity 3: Pseudocode to Python
START
INPUT number
IF number > 0
PRINT "Positive"
ELSE
PRINT "Negative"
END
Student Task: Convert to Python
num = int(input("Enter number: "))
if num > 0:
print("Positive")
else:
print("Negative")
Output:
✔ Understand logic → code
3|Page D r. A r o s h a M e d i w a k e
Activity 6: Decision Making Game (If–Else)
(Covers: Selection – 9.8)
Task:
Create a program to check if a student passed or failed.
marks = int(input("Enter marks: "))
if marks >= 50:
print("Pass")
else:
print("Fail")
Student Activity:
• Predict output for different marks (30, 50, 75)
• Modify pass mark (e.g., 40)
Fun Twist:
Add “Grade” (A, B, C)
Activity 7: Traffic Light Simulator
(Covers: Multiple conditions – 9.8)
Task:
Simulate a traffic light system.
color = input("Enter light color: ")
if color == "red":
print("Stop")
elif color == "yellow":
print("Ready")
else:
print("Go")
Student Task:
• Add more conditions (e.g., blinking)
• Convert to Sinhala/English messages
4|Page D r. A r o s h a M e d i w a k e
Activity 8: Loop Printing Challenge
(Covers: Iteration – 9.8)
Task:
Print numbers from 1 to 10
for i in range(1, 11):
print(i)
Mini Challenges:
• Print only even numbers
• Print backward (10 → 1)
• Print multiplication table of 5
Activity 9: Guess the Number Game
(Covers: Loop + condition – 9.8)
Task:
Simple guessing game
secret = 5
guess = int(input("Guess the number: "))
while guess != secret:
print("Try again")
guess = int(input("Guess the number: "))
print("Correct!")
Extension:
Add attempt count
Random number (advanced)
5|Page D r. A r o s h a M e d i w a k e
Activity 10: Create Your First Function
(Covers: Functions – 9.9)
Task:
Create a function to greet user
def greet(name):
print("Hello", name)
greet("Arosha")
Student Activity:
• Change message
• Call function multiple times
• Use input instead of fixed name
Challenge:
Create function to add two numbers
def add(a, b):
return a + b
print(add(5, 3))
6|Page D r. A r o s h a M e d i w a k e
Activity 11: Sum Calculator
(Loops – for loop)
Objective:
Calculate the total of numbers from 1 to 10
Task:
Write a program to find the sum
Code:
total = 0
for i in range(1, 11):
total = total + i
print("Sum =", total)
Output:
Sum = 55
Extension:
Change range (1–20)
Take number from user
Activity 12: Multiplication Table Generator ✖️
(Loops – for loop)
Objective:
Display multiplication table
Task:
Get a number from user and print its table
Code:
num = int(input("Enter a number: "))
for i in range(1, 11):
print(num, "x", i, "=", num * i)
7|Page D r. A r o s h a M e d i w a k e
Output Example:
5x1=5
5 x 2 = 10
...
Extension:
Print tables from 1 to 5
Format nicely using f-strings
Activity 13: Even Number Counter
(Loops + condition)
Objective:
Identify even numbers
Task:
Count even numbers between 1 and 20
Code:
count = 0
for i in range(1, 21):
if i % 2 == 0:
count = count + 1
print("Total even numbers =", count)
Output:
Total even numbers = 10
Extension:
Print the even numbers also
Count odd numbers
Activity 14: Reverse Number Display
(Loops – reverse iteration)
8|Page D r. A r o s h a M e d i w a k e
Objective:
Understand reverse loops
Task:
Print numbers from 5 to 1
Code:
for i in range(5, 0, -1):
print(i)
Output:
5
4
3
2
1
Extension:
Print from 10 to 1
Create a pattern (triangle)
Activity 15: Password Checker System
(While loop + condition)
Objective:
Use loop with condition
Task:
Keep asking password until correct
Code:
password = "python"
user = input("Enter password: ")
while user != password:
print("Wrong password")
user = input("Enter password: ")
9|Page D r. A r o s h a M e d i w a k e
print("Access granted")
Output Example:
Wrong password
Wrong password
Access granted
Extension (Important):
Limit attempts to 3
password = "python"
attempts = 0
while attempts < 3:
user = input("Enter password: ")
if user == password:
print("Access granted")
break
else:
print("Wrong password")
attempts += 1
if attempts == 3:
print("Account Locked")
10 | P a g e D r. A r o s h a M e d i w a k e
Activity 16: My Favourite Subjects List
(Lists – basics)
Objective:
Understand list creation and access
Task:
Create a list of 5 favourite subjects and print them
Code:
subjects = ["ICT", "Maths", "Science", "English", "Art"]
print("My Subjects:", subjects)
print("First Subject:", subjects[0])
print("Last Subject:", subjects[-1])
Output Example:
My Subjects: ['ICT', 'Maths', 'Science', 'English', 'Art']
First Subject: ICT
Last Subject: Art
Extension:
Add a new subject using .append()
Change one subject
Activity 17: Student Marks Analyzer
(Lists + loop)
Objective:
Work with lists and loops
Task:
Store marks and calculate total + average
Code:
marks = [65, 70, 80, 75, 90]
total = 0
11 | P a g e D r. A r o s h a M e d i w a k e
for m in marks:
total += m
average = total / len(marks)
print("Total =", total)
print("Average =", average)
Output:
Total = 380
Average = 76.0
Extension:
Find highest mark
Count pass students
Activity 18: Tuple Demo
(Tuples – immutable data)
Objective:
Understand tuple vs list
Task:
Create a tuple and try to change value
Code:
colors = ("red", "green", "blue")
print(colors)
print("First color:", colors[0])
# Try this (will give error)
# colors[0] = "yellow"
Learning Point:
Tuples cannot be changed (immutable)
12 | P a g e D r. A r o s h a M e d i w a k e
Extension:
Convert tuple to list and modify
Activity 19: Student Details Dictionary
(Dictionaries – key-value)
Objective:
Store structured data
Task:
Create a student record
Code:
student = {
"name": "Kamal",
"age": 16,
"subject": "ICT"
}
print("Name:", student["name"])
print("Age:", student["age"])
print("Subject:", student["subject"])
Output:
Name: Kamal
Age: 16
Subject: ICT
Extension:
Add new key: "marks"
Update age
Activity 20: Mini Project – Student Report System
(Lists + Dictionary + Logic)
Objective:
Combine all concepts
13 | P a g e D r. A r o s h a M e d i w a k e
Task:
Create a simple student report
Code:
student = {
"name": "Nimal",
"marks": [60, 75, 80]
}
total = sum(student["marks"])
average = total / len(student["marks"])
print("Name:", student["name"])
print("Total:", total)
print("Average:", average)
if average >= 50:
print("Status: Pass")
else:
print("Status: Fail")
Output Example:
Name: Nimal
Total: 215
Average: 71.6
Status: Pass
Activity 16: My Favourite Subjects List
(Lists – basics)
14 | P a g e D r. A r o s h a M e d i w a k e
Objective:
Understand list creation and access
Task:
Create a list of 5 favourite subjects and print them
Code:
subjects = ["ICT", "Maths", "Science", "English", "Art"]
print("My Subjects:", subjects)
print("First Subject:", subjects[0])
print("Last Subject:", subjects[-1])
Output Example:
My Subjects: ['ICT', 'Maths', 'Science', 'English', 'Art']
First Subject: ICT
Last Subject: Art
Extension:
Add a new subject using .append()
Change one subject
Activity 17: Student Marks Analyzer
(Lists + loop)
Objective:
Work with lists and loops
Task:
Store marks and calculate total + average
Code:
marks = [65, 70, 80, 75, 90]
total = 0
for m in marks:
total += m
15 | P a g e D r. A r o s h a M e d i w a k e
average = total / len(marks)
print("Total =", total)
print("Average =", average)
Output:
Total = 380
Average = 76.0
Extension:
Find highest mark
Count pass students
Activity 18: Tuple Demo
(Tuples – immutable data)
Objective:
Understand tuple vs list
Task:
Create a tuple and try to change value
Code:
colors = ("red", "green", "blue")
print(colors)
print("First color:", colors[0])
# Try this (will give error)
# colors[0] = "yellow"
Learning Point:
Tuples cannot be changed (immutable)
Extension:
Convert tuple to list and modify
16 | P a g e D r. A r o s h a M e d i w a k e
Activity 19: Student Details Dictionary
(Dictionaries – key-value)
Objective:
Store structured data
Task:
Create a student record
Code:
student = {
"name": "Kamal",
"age": 16,
"subject": "ICT"
}
print("Name:", student["name"])
print("Age:", student["age"])
print("Subject:", student["subject"])
Output:
Name: Kamal
Age: 16
Subject: ICT
Extension:
Add new key: "marks"
Update age
Activity 20: Mini Project – Student Report System
(Lists + Dictionary + Logic)
Objective:
Combine all concepts
Task:
Create a simple student report
17 | P a g e D r. A r o s h a M e d i w a k e
Code:
student = {
"name": "Nimal",
"marks": [60, 75, 80]
}
total = sum(student["marks"])
average = total / len(student["marks"])
print("Name:", student["name"])
print("Total:", total)
print("Average:", average)
if average >= 50:
print("Status: Pass")
else:
print("Status: Fail")
Output Example:
Name: Nimal
Total: 215
Average: 71.6
Status: Pass
File Handling + Searching + Sorting Activities
Activity 31: Write to a File
(File Handling – write)
18 | P a g e D r. A r o s h a M e d i w a k e
Objective:
Create and write data to a file
Task:
Write student name into a file
Code:
file = open("[Link]", "w")
[Link]("Nimal")
[Link]()
Output:
File created with content: Nimal
Extension:
Write multiple names
Activity 32: Read from File
(File Handling – read)
Objective:
Read data from file
Task:
Display file content
Code:
file = open("[Link]", "r")
data = [Link]()
print(data)
[Link]()
Activity 33: Append Data
(File Handling – append)
Objective:
Add data without deleting existing content
19 | P a g e D r. A r o s h a M e d i w a k e
Task:
Add new student name
Code:
file = open("[Link]", "a")
[Link]("\nKamal")
[Link]()
Activity 34: Count Lines in File
(File Handling + loop)
Objective:
Process file data
Task:
Count number of lines
Code:
file = open("[Link]", "r")
count = 0
for line in file:
count += 1
print("Total lines =", count)
[Link]()
Activity 35: Search in File
(Searching)
Objective:
Find specific data
Task:
Search for a name
Code:
20 | P a g e D r. A r o s h a M e d i w a k e
file = open("[Link]", "r")
name = input("Enter name to search: ")
found = False
for line in file:
if name in line:
found = True
if found:
print("Found")
else:
print("Not Found")
[Link]()
Activity 36: Linear Search in List
(Searching – basic)
Objective:
Search in list
Task:
Find number in list
Code:
def linear_search(data, key):
for i in range(len(data)):
if data[i] == key:
return i
return -1
nums = [10, 20, 30, 40]
print(linear_search(nums, 30))
21 | P a g e D r. A r o s h a M e d i w a k e
Activity 37: Bubble Sort (Ascending)
(Sorting)
Objective:
Understand sorting logic
Task:
Sort numbers
Code:
def bubble_sort(data):
n = len(data)
for i in range(n):
for j in range(0, n-i-1):
if data[j] > data[j+1]:
data[j], data[j+1] = data[j+1], data[j]
nums = [5, 2, 9, 1]
bubble_sort(nums)
print(nums)
Activity 38: Sort Using Built-in Method
(Sorting – simple)
Objective:
Use Python shortcut
Task:
Sort list
Code:
nums = [5, 2, 9, 1]
[Link]()
print(nums)
22 | P a g e D r. A r o s h a M e d i w a k e
Activity 39: Descending Order Sort
(Sorting variation)
Objective:
Reverse sorting
Task:
Sort in descending order
Code:
nums = [5, 2, 9, 1]
[Link](reverse=True)
print(nums)
Activity 40: Mini Project – Student File System
(File + Search + Logic)
Objective:
Combine all concepts
Task:
Store marks and search student
Code:
# Write data
file = open("[Link]", "w")
[Link]("Nimal 75\nKamal 60\nSunil 80")
[Link]()
# Read and search
file = open("[Link]", "r")
name = input("Enter student name: ")
23 | P a g e D r. A r o s h a M e d i w a k e
for line in file:
if name in line:
print("Record:", line)
[Link]()
Basic Searching Logic Activities
Activity 1: Find a Number in List
Objective: Understand basic search
24 | P a g e D r. A r o s h a M e d i w a k e
Task:
Check whether a number exists in a list
Code:
numbers = [10, 20, 30, 40, 50]
key = int(input("Enter number to search: "))
found = False
for n in numbers:
if n == key:
found = True
if found:
print("Number Found")
else:
print("Not Found")
Activity 2: Search and Show Position
Objective: Find index
Task:
Display position of number
Code:
numbers = [5, 15, 25, 35]
key = int(input("Enter number: "))
for i in range(len(numbers)):
if numbers[i] == key:
print("Found at index:", i)
Note:
If not found, no output (students can improve)
25 | P a g e D r. A r o s h a M e d i w a k e
Activity 3: Search Name in List
Objective: Work with strings
Task:
Check if name exists
Code:
names = ["Kamal", "Nimal", "Sunil"]
name = input("Enter name: ")
if name in names:
print("Name Found")
else:
print("Not Found")
Activity 4: Count Occurrences
Objective: Count repeated values
Task:
Count how many times a number appears
Code:
numbers = [2, 4, 2, 6, 2, 8]
key = int(input("Enter number: "))
count = 0
for n in numbers:
if n == key:
count += 1
print("Count =", count)
26 | P a g e D r. A r o s h a M e d i w a k e
Activity 5: Search in File
Objective: Apply search in real data
Task:
Search a word in file
Code:
file = open("[Link]", "r")
word = input("Enter word: ")
found = False
for line in file:
if word in line:
found = True
if found:
print("Word Found")
else:
print("Not Found")
[Link]()
Easy List Searching Activities
Activity 1: Check Number Exists
Objective: Basic searching
27 | P a g e D r. A r o s h a M e d i w a k e
Task:
Check if a number is in the list
Code:
numbers = [10, 20, 30, 40]
key = int(input("Enter number: "))
if key in numbers:
print("Found")
else:
print("Not Found")
Activity 2: Search Using Loop
Objective: Understand loop-based searching
Task:
Search number manually using loop
Code:
numbers = [1, 3, 5, 7, 9]
key = int(input("Enter number: "))
found = False
for n in numbers:
if n == key:
found = True
if found:
print("Found")
else:
print("Not Found")
Activity 3: Find First Position
28 | P a g e D r. A r o s h a M e d i w a k e
Objective: Get index
Task:
Display index of number
Code:
numbers = [5, 10, 15, 20]
key = int(input("Enter number: "))
for i in range(len(numbers)):
if numbers[i] == key:
print("Position:", i)
break
Activity 4: Search a Name
Objective: Work with text
Task:
Search a name in list
Code:
names = ["Asha", "Kamal", "Nimal"]
name = input("Enter name: ")
if name in names:
print("Name Found")
else:
print("Not Found")
Activity 5: Count Matches
Objective: Count occurrences
Task:
Count how many times a number appears
29 | P a g e D r. A r o s h a M e d i w a k e
Code:
numbers = [2, 2, 4, 6, 2]
key = int(input("Enter number: "))
count = 0
for n in numbers:
if n == key:
count += 1
print("Count =", count)
Mini Challenge (Very Useful)
Modify Activity 3:
• Print "Not Found" if number is missing
• Show position starting from 1 (not 0)
Simple Sorting Activities
Activity 1: Sort a List (Ascending)
Objective: Basic sorting
30 | P a g e D r. A r o s h a M e d i w a k e
Task:
Sort numbers in ascending order
Code:
numbers = [5, 2, 9, 1]
[Link]()
print("Sorted list:", numbers)
Output:
[1, 2, 5, 9]
Activity 2: Sort in Descending Order
Objective: Reverse sorting
Task:
Sort numbers from highest to lowest
Code:
numbers = [5, 2, 9, 1]
[Link](reverse=True)
print("Descending:", numbers)
Output:
[9, 5, 2, 1]
Activity 3: Sort Names Alphabetically
Objective: Sorting strings
Task:
Sort names A → Z
Code:
31 | P a g e D r. A r o s h a M e d i w a k e
names = ["Kamal", "Asha", "Nimal"]
[Link]()
print("Sorted names:", names)
Output:
['Asha', 'Kamal', 'Nimal']
Activity 4: Create New Sorted List
Objective: Keep original list unchanged
Task:
Use sorted()
Code:
numbers = [8, 3, 6, 1]
new_list = sorted(numbers)
print("Original:", numbers)
print("Sorted:", new_list)
Activity 5: Simple Bubble Sort
Objective: Understand sorting logic
Task:
Sort manually (step-by-step method)
Code:
numbers = [4, 2, 3]
for i in range(len(numbers)):
for j in range(len(numbers) - 1):
if numbers[j] > numbers[j + 1]:
numbers[j], numbers[j + 1] = numbers[j + 1], numbers[j]
32 | P a g e D r. A r o s h a M e d i w a k e
print("Sorted:", numbers)
33 | P a g e D r. A r o s h a M e d i w a k e
34 | P a g e D r. A r o s h a M e d i w a k e
35 | P a g e D r. A r o s h a M e d i w a k e
Bubble Sort
Code:
numbers = [5, 2, 9, 1]
# Outer loop (repeat sorting process)
for i in range(len(numbers)):
# Inner loop (compare adjacent elements)
for j in range(len(numbers) - 1):
# Compare two numbers
if numbers[j] > numbers[j + 1]:
# Swap if they are in wrong order
numbers[j], numbers[j + 1] = numbers[j + 1], numbers[j]
print("Sorted list:", numbers)
Line by Line Explanation
numbers = [5, 2, 9, 1]
Create a list of numbers (unsorted)
for i in range(len(numbers)):
Repeat the sorting process multiple times
len(numbers) = 4 → loop runs 4 times
for j in range(len(numbers) - 1):
Compare elements one by one
-1 because we compare j with j+1
if numbers[j] > numbers[j + 1]:
36 | P a g e D r. A r o s h a M e d i w a k e
Check if current number is greater than next
If YES → they are in wrong order
numbers[j], numbers[j + 1] = numbers[j + 1], numbers[j]
Swap the two numbers
This moves bigger number to the right
print("Sorted list:", numbers)
Display final sorted list
How It Works (Simple Idea)
Start:
[5, 2, 9, 1]
Step-by-step:
• Compare 5 & 2 → swap → [2, 5, 9, 1]
• Compare 5 & 9 → OK
• Compare 9 & 1 → swap → [2, 5, 1, 9]
Repeat again until sorted:
Final:
[1, 2, 5, 9]
37 | P a g e D r. A r o s h a M e d i w a k e
38 | P a g e D r. A r o s h a M e d i w a k e