ЁЯУШ Unit 7.1: Block It Out
Moving from Blocks to Text-Based Programming
How Does a Calculator Work? (The IPO Model)
A calculator works exactly like a computer program using the Input → Processing → Output model.
| Stage | What happens (Example: 10 + 5) |
|---|---|
| Input | Entering numbers (10 and 5) |
| Operation | Pressing the Addition button (+) |
| Processing | The calculator performs 10 + 5 |
| Output | The answer (15) appears on screen |
Scenario: Breaking Down the Ashoka Trees Problem
Given: Existing trees = 13, Planted today = 28, Planted tomorrow = 36.
- 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.
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).
Scratch (Block-Based) vs. Python (Text-Based)
| Feature | Scratch (Block-Based) | Python (Text-Based) |
|---|---|---|
| Method | Drag-and-drop graphical blocks | Typing code instructions |
| Difficulty | Easy for beginners | Requires learning syntax |
| Errors | Fewer typing errors (blocks fit) | Typing/syntax errors are possible |
| Use Case | Learning programming logic | Real-world applications & software |
What is Syntax?
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.
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.
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, whereageis the variable and15is the value).
# Python IPO Example
number1 = int(input("Enter number 1: ")) # ЁЯУе Input
number2 = int(input("Enter number 2: ")) # ЁЯУе Input
answer = number1 + number2 # ⚙️ Processing
print(answer) # ЁЯУд Output
Arithmetic Operators in Python
| Operator | Meaning | Python Example | Answer |
|---|---|---|---|
+ | Addition | 5 + 3 | 8 |
- | Subtraction | 5 - 3 | 2 |
* | Multiplication | 5 * 3 | 15 |
/ | Division | 6 / 3 | 2 |
* for multiplication, NOT ×.
What is an Algorithm?
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.
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 |
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).
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)
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 |
ЁЯза Super-Easy Memory Map
ЁЯОп 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)
ЁЯОУ 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!
ЁЯТм WhatsApp: +94 729622034
ЁЯУз Email: ITClassSL@gmail.com
ЁЯМР Explore Our Resources & Communities
Stay updated with our latest tutorials, project ideas, and student guides across all our official platforms:
- ЁЯУ║ YouTube Tutorials: Subscribe to our Channel
- ЁЯТ╝ Professional Network: Connect on LinkedIn
- ✍️ Tech Blog: Visit our WordPress Site
- ❓ Project Q&A: Follow our Quora Guide Profile
- ЁЯУ░ Monthly Updates: Read Our Newsletter
- ЁЯМР Official Portfolios: Wix Site | Google Business | Strikingly Portfolio
- ЁЯЧг️ Student Forum: Join our ElaKiri Discussion Thread