ICT Elective C - Chapter 1

Algorithm Design & Basics of Python Programs

Master the fundamentals of algorithms, pseudocode, flowcharts, Python programming, control structures, and data structures through interactive learning.

5
Major Topics
12
Quiz Questions
26
Flashcards

Table of Contents

Click any card to jump to that section

Core Concepts
Python Basics
Control Structures
Data Structures
Interactive Quiz
Flashcards
Practice Exercises

Algorithms & Core Concepts

Understanding algorithms, IPO cycle, pseudocode, flowcharts, and trace tables

What is an Algorithm?

An algorithm is a set of steps for solving a problem in a specified order. The process of comprehending an algorithm or a program is called a dry run, which is a commonly used technique for deducing the purpose and output of an algorithm or a program.

Input-Process-Output (IPO) Cycle

The IPO cycle is a tool for problem analysis and an important structure of an algorithm or program:

Input
Data used by the program
→
Process
Method/procedure performed
→
Output
Information returned
Example: BMI Calculator
Input: Weight (kg), Height (m) → Process: BMI = Weight / Height² → Output: Body Mass Index

Pseudocode & Flowcharts

There are three common ways to express algorithms: everyday words, pseudocode, and flowcharts.

OperationPseudocodeFlowchart Shape
Start / EndN/ARounded rectangle
Process / AssignmentA ← 21Rectangle
Input / OutputInput A, BParallelogram
DecisionIf A = B thenDiamond
Sub-programProABCDouble-sided rectangle

Trace Table

A trace table helps us comprehend an algorithm in depth, trace changes in variables and states of inputs/outputs, and spot mistakes.

PseudocodeValue of AValue of B
A ← 22N/A
B ← 525
A ← B - A35
A ← A * B155
B ← A - B1510

Python Programming Basics

Variables, data types, I/O statements, operators, and expressions

Variables & Data Types

Variables are locations in computer memory for data storage. Python has 4 simple data types:

TypeDescription
intIntegers (positive & negative)
floatDecimals
boolTrue or False
strText strings
Variable Naming Rules:
1. Start with letter or underscore (_)
2. Only letters, numbers, underscore
3. Cannot use reserved words (e.g. print, for, if)

Input & Output

Output: print() displays content to the console.

print("Hello") # Output: Hello name = "Sam" print("Hi", name) # Output: Hi Sam

Input: input() receives user data as a string. Use int() or float() to convert.

name = input() mark = int(input("Enter mark: "))

Arithmetic & Boolean Operators

Arithmetic Operators

OperationSymbol
Addition+
Subtraction-
Multiplication*
Division/
Integer Division//
Modulus%
Exponent**

Relational Operators

MeaningSymbol
Equal to==
Not equal to!=
Less than<
Greater than>
Less/equal<=
Greater/equal>=
Operator Precedence (High to Low):
() → ** → -(neg) → *, /, //, % → +, - → comparisons → not → and → or
Boolean Operators: and, or, not are used to combine or negate Boolean expressions.

Control Structures

Selection (if/elif/else) and Iteration (for/while loops)

Sequence
Selection
Iteration

Data Structures

1D arrays (lists), strings, and 2D arrays

Knowledge Quiz

Test your understanding of Chapter 1 concepts

Score: 0 / 12
Select answers then submit

Flashcard Review

Click cards to flip and review key concepts

Practice Exercises

Practice with exam-style questions from the textbook