Design Technology Grade7 - Term 1: Unit 1: Algorithms and Programming

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 42

Design Technology

Grade7 – Term 1
UNIT 1: Algorithms and
programming
Week Unit Lesson 1 Pages

Student Book 26-33


2 1 Activity Book 15-17
Learning outcomes:

 Apply appropriate names to variables that


represent different data types.
 Use pseudocode to plan an algorithm for a
programming problem.

4
Last week
Lesson 1: Decomposition and algorithms
• What is decompaction?

 Break down problem into


subproblems.

 The steps or instructions that you


use to solve a problem
• Which one is pseudocode?
Variables
Variables are a basic method of data storage that you
can use in programming to store a piece of
information using either text, number or Boolean data
types.
For example, in a computer game, a variable may be used
to store a user score. The user score can change during
the game.

Number

Score Number
PYTHON PROGRAMMING

●print(“NAME”)
Inputs and outputs
Type casting
Sometimes, you may need to change the data type of a variable. For
example, if you were doing calculations you would need to change
string data to numeric data before using it with a calculator:
Programming constructs
Programming constructs

Selection Repetition
Sequence
Sequence is the simplest programming

Sequence construct. Programming instructions in a


sequence are carried out once in the
order they are written. So far this term
you have only created text-based
programs using this construct.
Activity 8 , AB. Page 15

Python online

15
Selection
• Selection is a programming construct that
uses decisions.
• Programs that using selection choose
which instructions to execute.
• You can create programs with decisions
by using conditional statements with
relational operators.
• Conditional statements are expressions
that give either a true or false result.
Conditional
operators

In this example:
• Line 1 uses a single = operator for assignment. This will store the value 100 in the variable.
• Line 2 uses two == operators to check if the value in the variable is equal to 200.
Activity 9 , AB. Page 16

https://wordwall.net/play/35287/192/194

18
Using if, elif and else

Condition

#if statement

number = 10

if (number <15): Colon

print(“Number is less than 15”)

Action if condition is true


If –else Statements

If-else Statement used to evaluate two statements.

Yes Is A > No
B?

Print A is Print B is
greater greater
conditional statements

In this example:
• Line 3 is a conditional statement using a greater than relational operator.
• Line 4 is the instruction to execute if the conditional statement is true.
• Line 6 is the instruction to execute if the conditional statement is false.
22
Checks Room Temperature
The flowchart shows an algorithm for a program that checks
room temperature.
Program
When the temperature of a room reaches 27 degrees
Celsius, the code block will print a warning message.
Activity 10, AB. Page 17

Python online

Submit your
answers on
Course home

24
Design Technology
Grade7 – Term 1
UNIT 1: Algorithms and
programming
Week Unit Lesson 2 Pages

Student Book 34-37


2 1 Activity Book 18-20
Learning outcomes:

 Apply appropriate names to variables that


represent different data types.
 Use pseudocode to plan an algorithm for a
programming problem.

26
Repetition :
Repetition is a programming construct that repeats instructions ; also
called iteration.
There are three main types of loops that used in repetition.
Count-controlled Loop
Conditional Loop
Conditional Loop
Infinite Loop
Activity 11, AB. Page 18
Python online
1

2
Submit your
answers on
Course home

32
Design Technology
Grade7 – Term 1
UNIT 1: Algorithms and
programming
Week Unit Lesson 3 Pages

Student Book 38-40


2 1 Activity Book 21-22
Learning outcomes:

Develop a program that includes


compound conditionals.

36
Programing constructs :
1. Sequence
2. Selection
3. Repetition
Compound Conditionals:
• Advanced programming construct that you can use
in computer programming .
• Type of selection that use two or more conditional
statements connected with logical operators.
• Conditional statements are expressions that give
either true or false.
N D
A
O T
R N
O
Activity 14, AB. Page 21

https://www.liveworksheets.com/gl3166805vf

42
Submit your
Activity 15, AB. Page 22 answers on
Course home

Python online

43
Thanks
!
44

You might also like