ALGORITHM
Keys Concepts # 1
January 2024
PYTHON
Key stage IV
Class IX
© ICT Curriculum, MoESD
Coding Concept | Sub - Concepts |
Algorithm |
|
Concept Overview
January 2024
PYTHON
Key stage IV
Class IX
© ICT Curriculum, MoESD
Objectives
Objectives
January 2024
PYTHON
Key stage IV
Class IX
© ICT Curriculum, MoESD
ALGORITHM
ACTIVITIES
January 2024
PYTHON
Key stage IV
Class IX
© ICT Curriculum, MoESD
Algorithm
An algorithm is a step-by-step set of instructions for performing a task.
Step | Algorithm |
1 | START |
2 | Read first number |
3 | Read second number |
4 | Add first and second number |
5 | Display the sum |
6 | STOP/End |
Inputs
Process
Output
January 2024
PYTHON
Key stage IV
Class IX
© ICT Curriculum, MoESD
Algorithm (cont.)
For an algorithm, you need to have the following:
January 2024
PYTHON
Key stage IV
Class IX
© ICT Curriculum, MoESD
Demo 1 - Brushing Your Teeth
Step | Algorithm |
1 | START |
2 | Walk to a bathroom. |
3 | Put toothpaste on the toothbrush. |
4 | Brush your teeth. |
5 | Rinse your mouth and toothbrush. |
6 | Put the toothbrush away. |
7 | STOP/End |
January 2024
PYTHON
Key stage IV
Class IX
© ICT Curriculum, MoESD
Activity 1 - Writing Algorithm
Washing hands
G-4
Preparing suja
Crossing a road
1
Washing hands
2
C
4
Cooking ema-datshi
3
January 2024
PYTHON
Key stage IV
Class IX
© ICT Curriculum, MoESD
Activity 1 - Solution
Algorithm for Crossing a road
Algorithm for Preparing suja
1
2
January 2024
PYTHON
Key stage IV
Class IX
© ICT Curriculum, MoESD
Activity 1 - Solution (cont.)
Algorithm for Preparing ema-datshi
Algorithm for Washing hands
3
4
January 2024
PYTHON
Key stage IV
Class IX
© ICT Curriculum, MoESD
Importance of Algorithm
To provide a straightforward explanation of how it works without getting into too technical.
5
To find a solution for the problem.
1
To understand
the core idea behind a problem.
3
To understand the flow of the problem.
2
To break down a complex problem into smaller and more manageable steps.
4
January 2024
PYTHON
Key stage IV
Class IX
© ICT Curriculum, MoESD
Characteristics of Algorithm
Watch the video to understand the characteristics of algorithm
January 2024
PYTHON
Key stage IV
Class IX
© ICT Curriculum, MoESD
Characteristics of Algorithm
Characteristics
of
Algorithm
Unambiguous
Finiteness
Algorithm steps should be clear and straightforward.
Algorithm should terminate after certain number of steps.
Output
Algorithm should have have at least one output.
Feasibility
Algorithm should be feasible.
Independent
Algorithm must be applicable to any language.
Input
Algorithm should have 0 or more inputs.
January 2024
PYTHON
Key stage IV
Class IX
© ICT Curriculum, MoESD
Demo 2 - Finding Average of Two Numbers
Write an algorithm to find the average of any two numbers entered by the user and display the result.
Step | Algorithm |
1 | START. |
2 | Read any two numbers(x and y). |
3 | Average = (x+y)/2. |
4 | Display Average. |
5 | STOP/End. |
Solution
January 2024
PYTHON
Key stage IV
Class IX
© ICT Curriculum, MoESD
Activity 2 - Multiplying Two Numbers
Solution
Write an algorithm to multiply any two numbers and display the result.
Step | Algorithm |
1 | START. |
2 | Take input for x and y. |
3 | Multiply = x * y. |
4 | Display Multiply. |
5 | STOP. |
January 2024
PYTHON
Key stage IV
Class IX
© ICT Curriculum, MoESD
Activity 3 - Area of Circle
Solution
Write an algorithm in your notebook to find the area of a circle when a user enters a radius from the keyboard and display the area.
Step | Algorithm |
1 | START. |
2 | Read a radius of a circle (r). |
3 | area = 3.14*r*r. |
4 | Display area. |
5 | STOP. |
January 2024
PYTHON
Key stage IV
Class IX
© ICT Curriculum, MoESD
Activity 4 - Perimeter of Rectangle
Solution
Write an algorithm in your notebook to find the perimeter of a rectangle and display the perimeter.
Step | Algorithm |
1 | START. |
2 | Read a length and width (l, w). |
3 | perimeter = 2*(l+w) or perimeter = l+w+l+w. |
4 | Display perimeter. |
5 | STOP. |
January 2024
PYTHON
Key stage IV
Class IX
© ICT Curriculum, MoESD
Activity 5 - Eligibility for voting
Solution
Write an algorithm in your notebook to check whether a person is eligible to cast a vote using the following criteria:
Step | Algorithm |
1 | START. |
2 | Read the age. |
3 | Check if age>= 18, then got to step 4 |
4 | Display ‘Eligible to vote’. |
5 | Otherwise, display ‘Not eligible to vote’. |
6 | STOP. |
January 2024
PYTHON
Key stage IV
Class IX
© ICT Curriculum, MoESD
Activity 6 - Even or Odd number
Solution
Arrange the given algorithm in correct order to check whether the number is even or odd.
Step | Algorithm |
1 | START. |
2 | Read the number(num). |
3 | R=num%2. |
4 | If R is equal to zero. |
5 | Display ‘Number is Even’. |
6 | Otherwise |
7 | Display ‘Number is Odd’. |
8 | STOP. |
January 2024
PYTHON
Key stage IV
Class IX
© ICT Curriculum, MoESD
Activity 7 - Check your understanding
Mention and explain the characteristics of an algorithm.
Unambiguous
Algorithm steps should be clear and straightforward.
1
Input
Algorithm may or may not take input.
2
Finiteness
Algorithm should terminate after certain number of steps.
3
Independent
Algorithm must be applicable to any language.
4
Feasibility
Algorithm should be feasible.
5
Output
Algorithm should have have at least one output.
6
January 2024
PYTHON
Key stage IV
Class IX
© ICT Curriculum, MoESD
Activity 8 - Importance of learning algorithm
List any three importance of learning algorithm.
To understand the core idea behind a problem.
To understand the flow of the problem.
To break down a complex problem.
January 2024
PYTHON
Key stage IV
Class IX
© ICT Curriculum, MoESD
Practice 1 - Greatest Number
Solution
Write an algorithm to find the greatest of two numbers.
Step | Algorithm |
1 | START |
2 | Read any two numbers a, b |
3 | Check if a>b, then go to step 4 |
4 | Display “a is greater than b” |
5 | Otherwise, Display “b is greater than a” |
6 | STOP |
January 2024
PYTHON
Key stage IV
Class IX
© ICT Curriculum, MoESD
Practice 2 - Pass or Fail
Solution
Write an algorithm that prompts the user to input their exam marks and determines whether they have passed or failed. The pass mark is 40 out of 100.
Step | Algorithm |
1 | START |
2 | Enter a mark [m] |
3 | Check if m>=40, then go to step 4 |
4 | Display ”Passed” |
5 | Otherwise, Display “Failed” |
6 | STOP |
January 2024
PYTHON
Key stage IV
Class IX
© ICT Curriculum, MoESD
Key Points
January 2024
PYTHON
Key stage IV
Class IX
© ICT Curriculum, MoESD
Key Points (Cont.)
January 2024
PYTHON
Key stage IV
Class IX
© ICT Curriculum, MoESD
བཀྲིན་ཆེ།
THANK YOU
January 2024
PYTHON
Key stage IV
Class IX
© ICT Curriculum, MoESD