ЁЯУЮ WhatsApp +94 729622034 | ITClassSL ICT Project, Coding, and Digital Marketing Training!
Struggling with your MSc, BIT, BSc, or HND project? Get guaranteed success with our individual/group online classes taught in English, Sinhala, or Tamil.
✅ PHP & Python Software Development and Automation mySQL Oracle
✅ Digital Marketing & E-Commerce Website Development
✅ Freelancing, Database Design, and AI ML Application Training
✅ All Grade ICT Tutorials, Notes, and Exam Preparation Free PDF Vi
Interactive Mode, Script Mode, Error Correction, and Variables
ЁЯУЪ About this guide: Complete, exam-friendly notes for learning Python Programming Basics. Master the difference between Interactive and Script modes, learn how to fix errors, add comments, and use variables with the print() statement.
Concept 1
What is Interactive Mode?
When you launch Python IDLE, you see the Python Shell with the >>> prompt. This is Interactive Mode, which allows individual Python commands to be typed directly and carried out immediately.
>>> print("Hello world")
Hello world
>>> (7+6)*2
26
>>>
⚠️ Important: Python is case-sensitive. You must type commands using lower-case letters (e.g., print, not Print). Also, you do not need the print command for basic calculations in the shell.
Keywords
Essential Vocabulary
Interactive mode: The Python shell allows commands to be entered and run immediately.
Python shell: The interactive mode environment where commands are typed directly.
Print statement: A Python command used to output text or values onto the screen.
Case sensitive: Able to distinguish between capital and small letters.
Interpreter: Translates Python code into machine code line by line.
Machine code: The binary language a computer uses to carry out instructions.
Practice
Interactive Mode Practice Tasks
Enter: print("Welcome to the Python Shell")
Enter a command to print your name: print("Your Name")
Fix the error:print("Hello World) (Missing closing quotation mark).
Fix the calculation:(7+3*2 is missing a bracket. Correct it to (7+3)*2 to get 20.
Try four of your own math commands (remember * is for multiplication).
Get Python to add 150 and 23, then multiply by 3: (150 + 23) * 3
Concept 2
What is Script Mode?
In Interactive Mode, code cannot be saved. Script Mode uses a text editor (like Notepad) to write, save, and run multiple lines of code as a complete program.
Steps to Create & Run:
Create: In the Python shell, select File → New File.
Type: Enter your code (e.g., print("Hello world")).
Save: Select File → Save As. Name it HelloWorld.py (the .py extension is required).
Run: Select Run → Run Module (or press F5). The output appears in the Shell window.
Concept 3
Correcting Errors in Script Mode
If there is an error, Python highlights it in red and provides an error message.
Print("Hello World")
# Error: NameError: name 'Print' is not defined
How to fix: Open the program, correct the mistake (change Print to print), save, and run again.
Concept 4
Adding Comments
Comments explain what the code does. The Python interpreter ignores them. Start a comment with a hash (#) symbol.
# This is an Adventure Game about The Digital Sweet Shop
# The program was written by me
print("Welcome to The Digital Sweet Shop")
print() # This prints a blank line
Keywords
Script Mode Vocabulary
Script mode: Python's text editor, allowing programmers to enter a list of commands executed together.
Execute: Another word for running a program.
Comments: Text entered by a programmer to improve code readability; starts with # in Python.
Practice
Hands-On Practice Tasks
Create a New File in IDLE.
Type: print("Welcome to my first program in Python")
Add a line to print your favourite hobby.
Save as My First Program.py and Run (F5).
Add these lines:
print("Did you know Python can do calculations? The line below displays 10")
print(7+3)
print("How about this? The calculation below should display 25")
print(7+3*2+5)
Fix the error: The last line outputs 18, not 25. Correct it to print((7+3)*2+5) and add a # comment above it explaining the BIDMAS/PEMDAS fix.
New Program: Create Maths Favourites.py that prints your name, favourite number, and favourite calculation (e.g., "Name: Adnan", "Favourite number: 7", "Favourite calculation: multiplication").
Concept 5
What is a Variable?
A variable is a named location in the computer's memory that stores data of a particular type. Data can be assigned directly in the code or from user input.
name = "Ardeel"
age = 12
address = "Station Road"
colour = "Red"
Concept 6
Printing with Variables
To print a variable alongside text, do not put the variable name in quotation marks. Use a comma to join the text and the variable.
print(name)
# Output: Ardeel
print("Your name is", name)
# Output: Your name is Ardeel
print("Your name is", name, ". Nice to meet you.")
# Output: Your name is Ardeel . Nice to meet you.
ЁЯФС Keyword:
Variable: A named memory location used to store data of a given type during program execution; a variable can change value as the program runs.
Practice
Variable Practice Tasks
Create a new file and type:
name = "Ardeel"
age = 12
address = "Station Road"
colour = "Red"
print("Your name is", name)
Add code to display the age: print("You are", age, "years old")
Complete the program to say: print("You live at", address)
Complete the program to say: print(colour, "is your favourite colour")
Final Task: Create a new program showing your name, age, address, and favourite colour. Save and run it.
❓ Frequently Asked Questions (FAQ)
Q: What is the difference between Python Interactive Mode and Script Mode?
A: Interactive Mode (Python Shell) allows you to type and execute single lines of code immediately, but they cannot be saved. Script Mode uses a text editor to write, save (.py), and run multiple lines of code as a complete program.
Q: What is a variable in Python?
A: A variable is a named location in the computer's memory used to store data of a particular type. Variables can change their value as the program runs.
Q: How do you add comments in Python?
A: In Python, you add comments by starting a line with a hash (#) symbol. The Python interpreter ignores any text on a line after the # symbol, making it useful for explaining code.
Q: Why is Python considered case-sensitive?
A: Python is case-sensitive, meaning it distinguishes between uppercase and lowercase letters. For example, 'print' is a valid command, but 'Print' will cause a NameError.
ЁЯУЪ About this guide: Complete, exam-friendly notes for Unit 7.1 ICT. Learn how to transition from block-based programming (Scratch) to text-based programming (Python), including the IPO model, algorithms, flowcharts, syntax, and essential mathematical formulas.
Concept 1
How Does a Calculator Work? (The IPO Model)
A calculator works exactly like a computer program using the Input → Processing → Output model.
Q1: Total trees? New trees (28 + 36 = 64) + Existing (13) = 77 trees.
Q2: Trees planted per worker-hour? Total trees (64) ÷ Total worker-hours (10 workers × 8 hours = 80) = 0.8 trees/hour.
Q3: Remaining trees for 4 workers? 6 workers planted 48 trees (6 × 8). Remaining = 64 - 48 = 16. Trees per remaining worker = 16 ÷ 4 = 4 trees each.
ЁЯОп Exam Tip: Breaking a large problem into smaller, manageable steps is called decomposition. Always solve step-by-step!
Concept 3
What is Programming?
Programming means giving instructions to a computer so that it can perform a specific task (e.g., adding numbers, calculating area, finding an average).
Syntax means the rules and structure that must be followed when writing programming code. It is like grammar in English.
English: ❌ "I school go" → ✅ "I go to school." Python: If syntax is incorrect, the program will produce an error.
Concept 6
What is Python & IDLE?
Python: A powerful text-based programming language used for websites, AI, data processing, and automation. Named by Guido van Rossum (inspired by Monty Python).
IDLE: Stands for Integrated Development and Learning Environment. It is the tool/environment used to write, edit, run, and test Python code.
Concept 7
Variables, Values, and the IPO in Python
Value: A piece of data (e.g., 10, 3.5).
Variable: A named container that stores a value (e.g., age = 15, where age is the variable and 15 is the value).
An algorithm is a step-by-step sequence of instructions used to solve a problem.
Example (Add two numbers): 1. Start → 2. Enter first number → 3. Enter second number → 4. Add them → 5. Display answer → 6. Stop.
Concept 10
What is a Flowchart?
A flowchart is a visual diagram that shows the sequence of actions in a program. It helps programmers plan before coding.
Symbol
Purpose
Oval
Start / Stop
Rectangle
Process / Calculation
Diamond
Decision (Yes/No)
Parallelogram
Input / Output
Arrow
Direction of flow
Concept 11
Why Do We Test Programs?
Testing ensures the program works correctly. It helps us find errors, check calculations, verify inputs, and ensure the output matches the expected result (e.g., if 10 + 5 outputs 20, there is an error).
Concept 12
Essential Mathematical Formulas
Area of a square:length × length (e.g., 5 × 5 = 25)
Area of a triangle:½ × base × height (e.g., ½ × 10 × 6 = 30)
Perimeter of a rectangle:2 × (length + width) (e.g., 2 × (10 + 5) = 30)
Average of three numbers:(Num1 + Num2 + Num3) ÷ 3 (e.g., (10 + 20 + 30) ÷ 3 = 20)
Concept 13
Important Exam Keywords
Keyword
Easy Meaning
GUI
Graphical User Interface (icons, menus, drag-and-drop)
Value
Data or number used in a program
Syntax
Rules/structure for writing code
Processing
Computer working on input to produce output
Concept 14
ЁЯза Super-Easy Memory Map
PROBLEM ↓ ALGORITHM ↓ FLOWCHART ↓ PROGRAM ↓ INPUT ↓ PROCESSING ↓ OUTPUT ↓ TEST
ЁЯОп Exam Tip: If asked "What is text-based programming?", write: "Programming that requires the programmer to type instructions/code using the syntax of a programming language, such as Python."
❓ Frequently Asked Questions (FAQ)
Q: What is the difference between block-based and text-based programming?
A: Block-based programming (like Scratch) uses graphical, drag-and-drop blocks to create programs, making it easier for beginners. Text-based programming (like Python) requires typing code and following specific syntax rules, and is used for real-world applications.
Q: What is the IPO model in computing?
A: The IPO model stands for Input → Processing → Output. It describes how a computer or program receives data (Input), works on it (Processing), and produces a result (Output).
Q: What is an algorithm and a flowchart?
A: An algorithm is a step-by-step method to solve a problem. A flowchart is a visual diagram that uses standard symbols (like ovals, rectangles, and diamonds) to show the sequence of actions in that algorithm.
Q: What is IDLE in Python?
A: IDLE stands for Integrated Development and Learning Environment. It is the default software environment used to write, edit, run, and test Python programs.
ЁЯОУ Expert ICT, Coding, School Classes, Digital Marketing & University Project Guidance
Struggling with your university final year project? Want to master coding, upscale your business with expert digital marketing, or learn absolute computer basics from scratch? We offer high-quality individual and group online classes conducted in English, Sinhala, or Tamil mediums. Get guaranteed academic success and professional growth with tailored guidance.
ЁЯОУ University Final Year Project Guidance & AI
Get specialized, end-to-end mentoring and technical support to pass your degree or master's program with flying colors:
ЁЯПл Targeted Institutes: Expert guidance tailored for BIT UCSC, UoM, SLIIT, NIBM, and other leading universities.
ЁЯФм Postgraduate Support: Comprehensive assistance for MSc Software Final Year Projects.
ЁЯдЦ AI & Smart Applications: Step-by-step implementation of AI, Machine Learning (ML), and automation modules.
✅ Guaranteed Success: Help with documentation, system architecture, coding, and viva preparation.
ЁЯПл School ICT & Corporate Beginner Classes
ЁЯТ╗ Non-IT Staff Computer Basics: Absolute beginner-friendly online classes covering essential computer skills, office tools, and internet operations.
ЁЯОТ Primary & Secondary (Grades 1-10): Interactive online ICT classes tailored to build strong foundations from early ages.
ЁЯУЭ Exam Prep: Dedicated training packages for GCE O/L, GCE A/L ICT, and GIT exams.
ЁЯМН Global Syllabuses: Complete curriculum coverage for Local, Edexcel, and Cambridge in English & Tamil Mediums.
ЁЯУв Software Development & Digital Marketing Services
⚙️ Software & Web Development: Professional custom software application and website development built using PHP & MySQL.
ЁЯОп Social Media Management: Content creation, publishing, and channel management for Facebook, Instagram, TikTok, and YouTube.
ЁЯУИ Ad Boosting: Highly targeted paid advertising campaigns to drive leads, traffic, and sales to your business.
ЁЯУЮ Connect With Us Instantly
Book your slot for online classes or get a premium tech service quote today!
Unit 10.6 - 10.8: Web Authoring, PHP, MySQL & Publishing
ЁЯУМ роЗрои்родрок் рокாроЯрод்родிрой் роиோроХ்роХроо்:Competencies 10.6, 10.7 & 10.8-ро▓் Web Authoring Tools, Static vs Dynamic Web Pages, PHP Basics, HTML Forms, GET/POST, MySQL Database Connectivity рооро▒்ро▒ுроо் Website Publishing роЖроХிропро╡ро▒்ро▒ை Theory, Code Examples, рооро▒்ро▒ுроо் Exam Q&A ро╡роЯிро╡ிро▓் роОро│ிрооைропாроХроХ் роХро▒்ро▒ுроХ்роХொро│்ро│ро▓ாроо்.
10.6
Web Authoring Tool & WYSIWYG
Web Authoring Tool: Web Pages-роР роЙро░ுро╡ாроХ்роХро╡ுроо், родிро░ுрод்родро╡ுроо், роиிро░்ро╡роХிроХ்роХро╡ுроо் рокропрой்рокроЯுрод்родрок்рокроЯுроо் рооெрой்рокொро░ுро│் (роО.роХா: Adobe Dreamweaver, Visual Studio Code, KompoZer).
WYSIWYG: "What You See Is What You Get". родிро░ைропிро▓் роиாроо் роХாрогுроо் ро╡роЯிро╡рооே роЗро▒ுродிропாроХ Web Page-ро▓் родோрой்ро▒ுроо் ро╡роЯிро╡рооாроХ роЗро░ுроХ்роХுроо்.
роирой்рооைроХро│்: Web Development роОро│ிродாроХிро▒родு, ро╡ேроХрооாроХ роЙро░ுро╡ாроХ்роХро▓ாроо், Visual Editing, Code Assistance (Syntax Highlighting, Auto-completion).
Primary Key: роТро╡்ро╡ொро░ு Record-роР родройிрод்родுро╡рооாроХ роЕроЯைропாро│роо் роХாрогுроо் Field (роО.роХா: StudentID).
SQL Commands
рооுроХ்роХிроп SQL Commands (CRUD)
-- 1. CREATE Database & Table
CREATE DATABASE school;
USE school;
CREATE TABLE student (
id INT PRIMARY KEY,
name VARCHAR(50),
age INT
);
-- 2. INSERT (Add Data)
INSERT INTO student (id, name, age) VALUES (1, 'Kamal', 18);
-- 3. SELECT (Retrieve Data)
SELECT * FROM student;
SELECT name, age FROM student WHERE id = 1;
-- 4. UPDATE (Modify Data)
UPDATE student SET age = 19 WHERE id = 1;
-- 5. DELETE (Remove Data)
DELETE FROM student WHERE id = 1;
⚠️ роОроЪ்роЪро░ிроХ்роХை:DELETE FROM student; роОрой்ро▒ு WHERE роЗро▓்ро▓ாрооро▓் роХொроЯுрод்родாро▓் Table-ро▓் роЙро│்ро│ роЕройைрод்родு Records-роХро│ுроо் роиீроХ்роХрок்рокроЯுроо்!
Connectivity
PHP & MySQL Connectivity
<?php
// 1. Connection роЙро░ுро╡ாроХ்роХுродро▓்
$conn = new mysqli("localhost", "root", "", "school");
// 2. Connection роЪро░ிрокாро░்род்родро▓்
if ($conn->connect_error) {
die("Connection failed");
}
// 3. Form Data-ро╡ை Save роЪெроп்родро▓் (INSERT)
$name = $_POST["name"];
$age = $_POST["age"];
$sql = "INSERT INTO student (name, age) VALUES ('$name', '$age')";
$conn->query($sql);
echo "Data saved";
// 4. Database-ро▓ிро░ுрои்родு Data рокெро▒ுродро▓் (SELECT)
$result = $conn->query("SELECT * FROM student");
while ($row = $result->fetch_assoc()) {
echo $row["name"] . "<br>";
}
?>
ЁЯФе рооுро┤ு Flow рооройродிро▓் ро╡ைрод்родிро░ுроХ்роХ:
HTML FORM → GET / POST → PHP → MySQL → SQL QUERY → DATABASE → PHP → HTML → BROWSER
ЁЯФС Key Keywords:
WYSIWYG = What You See Is What Get
$_GET / $_POST = Form Data рокெро▒
PRIMARY KEY = Unique Record Identifier
Local Publishing = XAMPP/WAMP (Testing)
Internet Publishing = Web Hosting + Domain
Q: WYSIWYG роОрой்ро▒ாро▓் роОрой்рой?
A: WYSIWYG роОрой்рокродு 'What You See Is What You Get' роОрой்рокродрой் роЪுро░ுроХ்роХроо். роЗродрой் рокொро░ுро│், родிро░ைропிро▓் роиாроо் роХாрогுроо் ро╡роЯிро╡рооே роЗро▒ுродிропாроХ Web Page-ро▓் родோрой்ро▒ுроо் ро╡роЯிро╡рооாроХ роЗро░ுроХ்роХுроо் роОрой்рокродாроХுроо்.
Q: Static Web Page рооро▒்ро▒ுроо் Dynamic Web Page-роХ்роХு роЗроЯைропிро▓ாрой ро╡ேро▒ுрокாроЯு роОрой்рой?
A: Static Web Page рооுрой்роХூроЯ்роЯிропே роиிро░்рогропிроХ்роХрок்рокроЯ்роЯ родроХро╡ро▓்роХро│ைроХ் роХாроЯ்роЯுроо். Dynamic Web Page роОрой்рокродு User Input, Database роЕро▓்ро▓родு роиேро░роо் рокோрой்ро▒ роиிрокрои்родройைроХро│ிрой் роЕроЯிрок்рокроЯைропிро▓் роЙро│்ро│роЯроХ்роХрод்родை роЙро░ுро╡ாроХ்роХுроо் роЕро▓்ро▓родு рооாро▒்ро▒ுроо்.
Q: HTML Form-ро▓் GET рооро▒்ро▒ுроо் POST method-роХ்роХு роЗроЯைропிро▓ாрой ро╡ேро▒ுрокாроЯு роОрой்рой?
A: GET method-ро▓் Data URL-ро▓் роХாрогрок்рокроЯுроо் рооро▒்ро▒ுроо் Search/Retrieval-роХ்роХு роПро▒்ро▒родு. POST method-ро▓் Data Request Body-ро▓் роЕройுрок்рокрок்рокроЯுроо் рооро▒்ро▒ுроо் Password рокோрой்ро▒ sensitive data submission-роХ்роХு ро╡ிро░ுроо்рокрод்родроХ்роХродு.