0% found this document useful (0 votes)
678 views19 pages

1 Scratch Material

The document provides instructions for a Scratch coding lesson on introducing students to the Scratch software. It includes 6 topics: 1) Introduction to Scratch, how to download and install it, and an overview of the editor interface. 2) Algorithms, inputs and outputs in Scratch using ask and say blocks. 3) Variables in Scratch - how to create and use them. 4) Data types in Scratch including strings, characters, integers, floats and Booleans. 5) Concatenation in Scratch to join two strings together. Each topic includes objectives, explanations of concepts, and examples of Scratch code to create simple programs introducing the concepts. Quizzes are included at the end of each topic section.

Uploaded by

Nobs Ubong
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
678 views19 pages

1 Scratch Material

The document provides instructions for a Scratch coding lesson on introducing students to the Scratch software. It includes 6 topics: 1) Introduction to Scratch, how to download and install it, and an overview of the editor interface. 2) Algorithms, inputs and outputs in Scratch using ask and say blocks. 3) Variables in Scratch - how to create and use them. 4) Data types in Scratch including strings, characters, integers, floats and Booleans. 5) Concatenation in Scratch to join two strings together. Each topic includes objectives, explanations of concepts, and examples of Scratch code to create simple programs introducing the concepts. Quizzes are included at the end of each topic section.

Uploaded by

Nobs Ubong
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

STUDENT NAME:___________________________________ DATE:__________________

PROJECT: MATHS GAME


TOPIC 1: Introduction, Download and Installation
Objectives: In today’s class, we will:
 Define the Scratch software.
 Download and Install Scratch.
 Explain the Editor.

1. Introduction
Scratch is a free, high-level, block-based visual
programming language and website where you can create
your own interactive stories, games, and animations.

2. What can you do with Scratch?


With Scratch, you can program your own interactive stories, games, and animations — and share your creations with
others in the online community. Scratch helps young people (4-16 years) learn to think creatively, reason systematically,
and work collaboratively — essential skills for life in the 21st century.

3. How to use Scratch Editor


Scratch Editor can be used online or offline.
 Online: To access Scratch online, visit the website: https://scratch.mit.edu/
 Offline: The offline version for Scratch 3.0 is available for Microsoft Windows 10 in the Microsoft Store and
Apple's MacOS 10.13. To download and install Scratch, visit: https://scratch.mit.edu/download

4. Scratch User interface


The Scratch interface is divided into three main sections:
1. Stage area,
2. Block palette, and
3. Coding area to place and arrange the blocks into scripts that can be run by pressing the green flag or clicking on
the code itself.
Users may also create their own code blocks and they will appear in "My Blocks".

TeenCoders Coding Club : www.teencoders.com.ng : #8 Old Aba Road, PH : 08039558839


STUDENT NAME:___________________________________ DATE:__________________
5. How to use Scratch
The stage area features the results (e.g., animations, turtle graphics, either in a small or normal size, with a full-screen
option also available) and all sprites thumbnails being listed in the bottom area. The stage uses x and y coordinates, with
0,0 being the stage center.

With a sprite selected at the bottom of the staging area, blocks of commands can be applied to it by dragging them from
the block palette into the coding area. The Costumes tab allows users to change the look of the sprite in order to create
various effects, including animation. The Sounds tab allows attaching sounds and music to a sprite.

When creating sprites and also backgrounds, users can draw their own sprite manually, choose a Sprite from the library,
or upload an image.

6. The categories of the programming blocks

Quiz 1
2 objectives and 1 theory from each section.

TeenCoders Coding Club : www.teencoders.com.ng : #8 Old Aba Road, PH : 08039558839


STUDENT NAME:___________________________________ DATE:__________________
TOPIC 2: Algorithm, Input and Output
Objectives: In today’s class, we will:
 Define Algorithm.
 Create a Scratch Project using input and output bocks.

1. Programming Basics
Programming is writing computer code to create a program, in
order to solve a problem. To program a computer, you need to
know how programs are constructed.

2. Algorithm
An algorithm is a list of steps you give a computer to solve a
problem or to get something done.
In coding, programmers write algorithms that instruct the
computer how to perform a task.
We use algorithms are every day and everywhere. A process for
making Indomie is an algorithm, the method you use to solve
addition is an algorithm, and the process of folding a shirt or a pair of trousers is an algorithm.
Write the algorithm to prepare Indomie.

3. Input and Output


One of the first things to learn in coding is, how to get values from the user (input) and how to show values to the user
(output). In Scratch, we can use ASK to get a value, and SAY to show a value.

4. Project 1: Introduce yourself


In this simple project, the computer will ask the user for him name, and then display the user’s name.

5. Write the Code


1. Locate Blocks: 2. Code the cat:
When Green Flag Events  When green flag clicked
Say () for () Looks  Say (Hello Welcome) for (2) seconds
Ask () and wait Sensing  Ask (What’s your name?) and wait
Answer Sensing  Say (Your name is: ) for (2) seconds
Stop () Control  Say (answer) for (2) seconds
 Stop (all)

Quiz.

TeenCoders Coding Club : www.teencoders.com.ng : #8 Old Aba Road, PH : 08039558839


STUDENT NAME:___________________________________ DATE:__________________
TOPIC 3: Variables
Objectives: In today’s class, we will:
 Define Variables.
 Create and use variables.

1. Variables
In coding, variables are containers for storing data values.
You can think of a variable as a box that contains something.
You can open the box to find out what is inside, or even put
something else into the box. Variables can change when the
user is asked a question, for example, their age.

2. Four steps to use a variable


1. Create the variable.
2. Name the variable.
3. Set the variable to an initial value at the beginning.
4. Assign a value to the variable.
In Scratch, we create a variable using (Make a Variable) in the Variables Block.

3. Project 2: Name Changer


In this simple project, the computer will show a name, and then ask the user for his/her name, each time the user types
a name, it changes the original name set by the computer.

4. Write the Code


1. Locate Blocks: 2. Code the cat:
When Green Flag Events  When green flag clicked
Set () to () Variables  Set (Name) to (Anietie Etuk)
Say () for () Looks  Say (Hello Welcome) for (2) seconds
Name Variables  Say (Name) for (2) seconds
Ask () and wait Sensing  Ask (1. What’s your name?) and wait
Answer Sensing  Set (Name) to (answer)
Stop () Control  Say (Your name is: ) for (2) seconds
 Say (answer) for (2) seconds
 Ask (2. What’s your name? ) and wait
 Set (Name) to (answer)
 Say (Your name is: ) for (2) seconds
 Say (answer) for (2) seconds
 Stop (all)

Quiz

TeenCoders Coding Club : www.teencoders.com.ng : #8 Old Aba Road, PH : 08039558839


STUDENT NAME:___________________________________ DATE:__________________
TOPIC 4: Data Types
Objectives: In today’s class, we will:
 Define data types.
 List and explain the 5 different data types.
 Variables.

1. Data Types
A data type determines what type of value an object can have and what operations can be performed. Variables can
store data of different types, and different types can do different things. In programming, there are 5 basic data types:
string, character, integer, float and Boolean.
s/n Data Type Description Used for Example
1 String Used for a combination of one or more characters that Alphanumeri -Anietie
appear on a keyboard, such as letters, numbers and symbols. c characters -8th August, 2021
A string represents alphanumeric data. This means that a -08/08/2021
string can contain many different characters, but they are all
considered as if they were text, even if the characters are
numbers.
2 Character A character is a single symbol, which can be a letter, a digit, a Encoding text -9
symbol, or a Chinese character, etc. numerically -&
-a
3 Integer An integer is a number with no decimal places. Whole -1
Integers are whole numbers and can be positive or negative. numbers -990
4 Float Used for numbers that contain decimal points, or for Number with -0.5
fractions. a decimal -96.103
point
5 Boolean Used where data is restricted to True/False or yes/no Representing -True
options. logical values -False

Quiz.

TeenCoders Coding Club : www.teencoders.com.ng : #8 Old Aba Road, PH : 08039558839


STUDENT NAME:___________________________________ DATE:__________________
TOPIC 5: Concatenation
Objectives: In today’s class, we will:
 Define concatenation.
 Create a simple project.

1. Concatenation
Concatenation means joining two strings
together. In many programming languages,
the symbol used for concatenation is a plus
( + ). A common use of concatenation is
when you want to display a message that
includes the value of a variable.
In Scratch, we can join values (concatenate)
using (join () ()) in the Operators Block.

2. Project 3: User details


In this simple project, the computer will ask
the user for his/her name and age, and then
create a sentence with it.

3. Write the Code


1. Locate Blocks: 2. Code the cat:
When Green Flag Events  When green flag clicked
Set () to () Variables  Set (Name) to (Anietie Etuk)
Say () for () Looks  Say [join (Hello) (Welcome)] for (2) seconds
Join () () Operators  Ask (What’s your name?) and wait
Name Variables  Say [join (Your name is: ) (answer)] for (2) seconds
Ask () and wait Sensing  Set (Name) to (answer)
Answer Sensing  Ask (How old are you?) and wait
Stop () Control  Say [join (Your name is: ) [join (Name) [join ( and
your age is: ) (answer)]]] for (2) seconds
 Stop (all)

Quiz

TeenCoders Coding Club : www.teencoders.com.ng : #8 Old Aba Road, PH : 08039558839


STUDENT NAME:___________________________________ DATE:__________________
TOPIC 6: Operators and Boolean
Objectives: In today’s class, we will:
 Define Operators
 List the type of operators.
 Define Boolean
 Create an Age Calculator.

1. Operators
An operator is a symbol that tells the program to perform specific
mathematical, relational or logical operation and produce final result.
For example 2 + 3 = x. The + and the = are called, operators.
Operands are the values used in these expressions, (2, 3 and x).

2. Types of Operators
There are mostly three types of operators:
1. Arithmetic operators
2. Relational operators
3. Logical operators

3. Arithmetic operators
Arithmetic operators allow arithmetic to be performed on values. The 4 arithmetic operators in scratch are:
s/n Arithmetic Operator Symbol Description Example
1 Addition + Adds two operands 30 + 5 will give 35
2 Subtraction - Subtracts second operand from the first 30 – 5 will give 25
3 Multiplication * Multiplies both operands 30 * 5 will give 150
4 Division / Divides numerator by de-numerator 30 / 5 will give 6

4. Project 4: Age Calculator


In this project, the computer will prompt the user for his name and
year of birth, and then output the user’s age.

5. Start the project


 Delete the Cat
 Change the backdrop (Jungle)
 Select the magician (Wizard girl)
 Add sounds (Boop Bing Bop, Crazy Laugh)
 Create the variables (Name, Age)

6. Write the Code


1. Locate Blocks: 2. Code:
When Green Flag Events  When green flag clicked
Set () to () Variables  Set (Name) to ( )
Play sound () Sound  Set (Age) to ( 0 )
until done  Play sound (Boop Bing Bop ) until done
Say () for () Looks  Say (Hello Welcome) for (2) seconds
Join () () Operators  Say (I am a magician. Today I will predict your age) for (5) seconds
Name Variables  Play sound (Crazy laugh ) until done
Ask () and wait Sensing  Ask (What’s your name?) and wait
Current (year) Sensing  Set (Name) to (answer)
Answer Sensing  Play sound (Crazy laugh ) until done

TeenCoders Coding Club : www.teencoders.com.ng : #8 Old Aba Road, PH : 08039558839


STUDENT NAME:___________________________________ DATE:__________________
Stop () Control  Say [join (Welcome: ) (answer)] for (2) seconds
Minus Operators  Ask (What year were you born?) and wait
 Set (Age) to [minus (Current year) - (answer)]
 Play sound (Crazy laugh ) until done
 Say [join (Name) [join ( , you were born in ) [join (answer) [join ( and
you are: ) [join (age) ( years old)]]]]] for (5) seconds
 Stop (all)

7. Relational operators
Relational operators allow for assignment and enable comparisons to be made. They
are used in condition testing. The 3 relational operators in scratch are:
s Relational Sy Description Example
/ Operator mb
n ol
1 Assignmen = Sign and assigns a variable a = 30
t
2 Greater > Checks if the value of left 30 > 5 is
than operand is greater than the true
value of right operand, if yes
then condition becomes true.
3 Less than < Checks if the value of left 30 < 5 is
operand is less than the value false
of right operand, if yes then
condition becomes true.

8. Logical operators
Logical operator help us take decisions based on certain conditions.
They are used to combine relational operators to give more complex decisions. The 3 logical operators in scratch are:
s/n Logical Operator Symbol Description Example
1 And and Returns True if both statements are true. (30 < 5 and 11 > 10) false
2 Or or Returns True if one of the statements is true. (30 < 5 and 11 > 10) true
3 Not not Reverse the result, returns False if the result is (true) false
true

9. Boolean
Booleans are data type that can contain either the value true or false.
Boolean statements are statements that evaluate to be true or false. An example of this might be 13 + 14 = 27, because
the statement evaluates to true, or 13 + 14 = 10, because the statement evaluates to false.

Boolean also refers to a system of logical thought that is used to create true/false statements. Boolean expressions use
the operators AND, OR, XOR and NOT to compare values and return a true or false result.

10. Error stopper


When asked “What year were you born?” What if the user types in a year of birth that is less than 0, or greater than the
current year, or a text?
We’ll improve the project, the magician will prompt the user for his/her name and year of birth, if the year of birth is
GREATER THAN 0 AND LESS THAN the current year = TRUE, the magician will output the user’s age, else the magician
will tell the user to try again with the correct value.

11. Write the Code

TeenCoders Coding Club : www.teencoders.com.ng : #8 Old Aba Road, PH : 08039558839


STUDENT NAME:___________________________________ DATE:__________________
1. Locate Blocks: 2. Code:
When Green Flag Events  When green flag clicked
Set () to () Variables  Set (Name) to ( )
Play sound () Sound  Set (Age) to ( 0 )
until done  Play sound (Boop Bing Bop ) until done
Say () for () Looks  Say (Hello Welcome) for (2) seconds
Join () () Operators  Say (I am a magician. Today I will predict your age) for (5) seconds
Name Variables  Play sound (Crazy laugh ) until done
Ask () and wait Sensing  Ask (What’s your name?) and wait
Current (year) Sensing  Set (Name) to (answer)
Answer Sensing  Play sound (Crazy laugh ) until done
Stop () Control  Say [join (Welcome: ) (answer)] for (2) seconds
Minus Operators  Ask (What year were you born?) and wait
If-Then-Else Control  If [And {Greater-Than (answer) > (0)} and {Less-Than (answer) <
And Operators (Current-Year)}]
Greater-Than Operators o Set (Age) to [minus (Current year) - (answer)]
Less-Than Operators o Play sound (Crazy laugh ) until done
o Say [join (Name) [join ( , you were born in ) [join (answer) [join
( and you are: ) [join (age) ( years old)]]]]] for (5) seconds
 Else
o Say [join (You said you were born in: ) [join (answer) ( . This is not
correct. You have to start again) for (5) seconds
 Play sound (Boop Bing Bop ) until done
 Say (Click the Green Flag to play again) for (5) seconds
 Stop (all)

Quiz

TeenCoders Coding Club : www.teencoders.com.ng : #8 Old Aba Road, PH : 08039558839


STUDENT NAME:___________________________________ DATE:__________________
TOPIC 7: Conditional Statements
Objectives: In today’s class, we will:
 Create a simple Maths Game.
 Learn about the Conditional statement.

1. Conditional Statements
A conditional statement tells a program to execute different actions
depending on whether a condition is true or false.
If a certain condition is true then a block of statement is executed otherwise
not.

In coding, you ask your computer to check conditions by writing conditional


statements. Conditional statements are the way computers can make
decisions. Conditional statements always have an if part, which tells the app
what to do when the condition is true.

In Scratch, we can write conditional statements using (if () then, if () then-else) in the Controls Block.

2. The Project Description:


In this Maths game, the computer will ask the user the sum of two numbers, if the user gets the correct answer, say
CORRECT, else say WRONG.

3. Write the code


1. Locate Blocks: 2. Code Marian:
When Green Flag Events  When green flag clicked
Say () for () Looks  Say (Good morning students and welcome to our
Ask () and wait Sensing Maths Class. Answer the following question.) for
If () then () else Control (5) seconds
= Operators  Ask (5 + 3 = ) and wait.
Answer Sensing  If [equals (Answer) = (8)] then
o Say (Correct) for (2) Seconds
 Else
o Say (Wrong) for (2) Seconds

TeenCoders Coding Club : www.teencoders.com.ng : #8 Old Aba Road, PH : 08039558839


STUDENT NAME:___________________________________ DATE:__________________
TOPIC 8: IF STATEMENTS.
Objectives: In today’s class, we will:
 Improve on the Maths Game.
 Use If Statements

2. The Project Description:


In this improved version of the Maths game, the
computer will randomly pick two numbers and ask the
user the sum of the two numbers. If the user gets the
correct answer, say CORRECT, else say WRONG.

3: Create the classroom


1. Set the backdrop (CHALKBOARD).
2. Add the teacher (MARIAN).
3. Add Sounds (Cheer, Scream 1)
4. Create the variables (Question 1, Question 2)

4: Write the code


1. Locate Blocks: 2. Code Marian:
When Green Flag Events  When green flag clicked
Set () to () Variables  Set (Question 1) to (0)
Say () for () Looks  Set (Question 2) to (0)
Pick random () to () Operators  Say (Good morning students and welcome to our Maths Class.) for
Ask () and wait Sensing (2) seconds
Question Variables  Say (Add the two numbers.) for (2) seconds.
Join Operators  Set (Question 1) to (pick random (1) to (10)
If () then () else Control  Set (Question 2) to (pick random (1) to (10)
+ Operators  Ask [join (Question 1) [join (+) [join (Question 2) (=) ]]] and wait.
= Operators  If [equal (Answer) = [plus (Question 1) + (Question 2) ]] then
Answer Sensing o Say (Correct) for (2) seconds.
Start sound () Sound o Start sound (Cheer)
 Else
o Say (Wrong) for (2) seconds.
o Start sound (Scream 1)

TeenCoders Coding Club : www.teencoders.com.ng : #8 Old Aba Road, PH : 08039558839


STUDENT NAME:___________________________________ DATE:__________________
TOPIC 9: PROCEDURES.
Objectives: In today’s class, we will:
 Define and use Procedures.
 Create a Student Result Grading App

1. Procedure
A procedure is a small section of a program that performs a
specific task. Procedures can be used repeatedly throughout a
program. A real-life example of a procedure is brushing your
teeth. Another example of a procedure is cracking eggs into a
bowl and beating them before scrambling them in a pan.

2. The Project Description: The Student Grade App


In this project, the app will get the student’s score in different
subjects, and inform the student of his grade.

3. Steps in the project


1. Create the (CHALKBOARD).
2. Select the teacher (MARIAN).
3. Create the variable = Student Name (This will be used to store the student’s name).
4. Create the variable for each subjects
5. Create the variable = Average Score (This will be used to calculate the average score.
6. Create the variable = Grade (This will be used to store the grade).
7. Set each variable to an initial value (use procedure to hold this repeated step).
8. Get the score of the student in each subject (use procedure to hold this repeated step).
9. Calculate and set the average.
10. Grade the student
a. Based on the grade, change the teacher’s costume, make the teacher to talk.

4. Settings
1. Subject: Maths, English, Science, CRK, ICT.
Grade: A, B, C, D, F.
2. A = 80% - 100% (greater than 79.99% and less than 100.01%)
3. B = 70% - 79% (greater than 69.99% and less than 79.999%)
4. C = 60% - 69% (greater than 59.99% and less than 69.999%)
5. D = 40% - 59% (greater than 39.99% and less than 59.999%)
6. F = 0% - 39% (greater than -0.01% and less than 39.999%)
Teacher Comments
7. A = Your GRADE is A. Excellent result! You are the best.
8. B = Your GRADE is B. Very good result. Keep it up.
9. C = Your GRADE is C. Good result. Keep improving.
10. D = Your GRADE is D. Average result. But I know you will do better.
11. F = Your GRADE is F. Below average result. You can do better.

5. Write the code (Marian)


1. When green flag clicked
2. Set (Student Name) to ()
3. Set (Maths) to (0)
4. Set (English) to (0)
5. Set (Science) to (0)
6. Set (CRK) to (0)
TeenCoders Coding Club : www.teencoders.com.ng : #8 Old Aba Road, PH : 08039558839
STUDENT NAME:___________________________________ DATE:__________________
7. Set (ICT) to (0)
8. Set (Average Score) to (0)
9. Set (Grade) to ()
10. Ask (What’s your name?) and wait
11. Set (Student Name) to (answer)
12. Ask (Maths Score: ) and wait
13. Set (Maths) to (answer)
14. Ask (English Score: ) and wait
15. Set (English) to (answer)
16. Ask (Science Score: ) and wait
17. Set (Science) to (answer)
18. Ask (CRK Score: ) and wait
19. Set (CRK) to (answer)
20. Ask (ICT Score: ) and wait
21. Set (ICT) to (answer)
Bring out the divide operator, put 4 addition operators to the left and write 5 in the right hole.
22. Set (Average Score) to [divide [plus (Maths) + [plus (English) + [plus (Science) + [plus (CRK) + (ICT) ]]]] / (5) ]
Bring out the and operator, to the left put a greater than operator. Put Average Score to the left and type 79.99 in
the right hole of the greater than sign. Put a less than sign in the left hold of the and operator. Put Average score
to the left and type 100.01 to the right of the less than sign.
23. If [and [greater than (Average Score) > (79.99) ] and [less than (Average Score) < (100.01) ]] then
a. Set (Grade) to (A)
Bring out 3 joins
b. Say [join (Student Name) [join ( , your average score is: ) [join (Average Score) ( . Your GRADE is A. Excellent
result! You are the best.) ]]] for (10) seconds.
Else
If [and [greater than (Average Score) > (69.99) ] and [less than (Average Score) < (79.999) ]] then
i. Set (Grade) to (B)
ii. Say [join (Student Name) [join ( , your average score is: ) [join (Average Score) ( . Your GRADE is B. Very
good result. Keep it up.) ]]] for (10) seconds.
Else
If [and [greater than (Average Score) > (59.99) ] and [less than (Average Score) < (69.999) ]] then
a. Set (Grade) to (C)
b. Say [join (Student Name) [join ( , your average score is: ) [join (Average Score) ( . Your GRADE is C.
Good result. Keep improving.) ]]] for (10) seconds.
Else
If [and [greater than (Average Score) > (39.99) ] and [less than (Average Score) < (59.999) ]] then
i. Set (Grade) to (D)
ii. Say [join (Student Name) [join ( , your average score is: ) [join (Average Score) ( . Your GRADE is
D. Average result. But I know you will do better.) ]]] for (10) seconds.
Else
If [and [greater than (Average Score) > (-0.01) ] and [less than (Average Score) < (39.999) ]]
then
i. Set (Grade) to (F)
ii. Say [join (Student Name) [join ( , your average score is: ) [join (Average Score) ( . Your
GRADE is F. Below average result. You can do better.) ]]] for (10) seconds.
Else
i. Say (You input a wrong score. Try again) for (5) seconds
24. Stop all

TeenCoders Coding Club : www.teencoders.com.ng : #8 Old Aba Road, PH : 08039558839


STUDENT NAME:___________________________________ DATE:__________________
TOPIC 10: LOOPS.
Objectives: In today’s class, we will:
 Define loops.
 Create 2 projects

1. Loops
In coding, a Loop is a command used to repeat a part of code until the desired process
is complete. A loop is used for executing a block of statements repeatedly until a
particular condition is satisfied. Typically, a certain process is done, such as getting an
item of data and changing it, and then some condition is checked such as whether a
counter has reached a prescribed number.

2. Types of loops
There are three main types of loops: for loops, do loops and while loops.
In Scratch 3.0, some of the blocks used to represent a loop process are, forever, repeat
(10), repeat until, all found in the control blocks.

3. The Project Description: Timer App


In this project, the app will display a counter from 1 to 10. You may set the value of a
variable to 1 and display it 10 times, increasing its value by 1 on each loop iteration.

4: Write the code (Cat)


1. Create the variable (Counter)

2. When green flag clicked


3. Set (Counter) to (0)
4. Repeat (10)
a. Change Counter by (1)
b. Wait (1) second
5. Stop all

5. The Project Description: Login App


In this project, the app will count how many times the user tries before he gets
the correct password.

6: Write the code (Cat)


1. Add backdrop (Castle, Castle 2)
2. Create the variable (Counter, Password)

3. When green flag clicked


4. Switch backdrop to (Castle 2)
5. Set (Counter) to (0)
6. Set (Password) to (1234567890)
7. Ask (What’s the password?) and wait
8. Repeat until [equals (Password) = (answer)]
a. Change Counter by (1)
b. Wait (1) second
c. Ask (What’s the password?) and wait
9. Switch backdrop to (Castle 1)
10. Stop all

TeenCoders Coding Club : www.teencoders.com.ng : #8 Old Aba Road, PH : 08039558839


STUDENT NAME:___________________________________ DATE:__________________
TOPIC 11: LOOPS.
Objectives: In today’s class, we will:
 Broadcast
 Extension blocks (Text-To-Speech)

1. Broadcast.
One method to direct the timing of events in a coding
project is to broadcast a message in Scratch. Broadcasting
sends a message to one or more sprites. The message is
used to trigger a script to run.
Broadcast is found in Events Block.

2. Text-To-Speech
Text-To-Speech turns text into natural-sounding speech in
different languages and different voices.
Use (Add Extension) to add the Text-To-Speech Block.

3. The Project Description: Maths Quiz


In this improved version of the Maths game, the player will be given
60 seconds to answer the questions. The score at the end will how
many questions the player answered, and how many he gets correctly.

4. Steps in the project


1. Create the (CHALKBOARD).
2. Select the teacher (MARIAN).
3. Create the variables
a. Counter = to count the number of questions the player
attempts.
b. Score = to record the number of correct answers.
c. Number 1 = to hold the first number.
d. Number 2 = to hold the second number.
e. Timer = to create a stop watch.
4. Create the broadcast:
a. Start_timer = to tell the counter when to start the
counting.
5. Include extension = speak

6. Say (Welcome to TeenCoders Maths Quiz. How many


questions can you answer correctly in 60 seconds. Your time
starts now.)
7. Speak (Welcome to TeenCoders Maths Quiz. How many
questions can you answer correctly in 60 seconds. Your time
starts now.)
8. Broadcast (Start_Timer)
9.
10. tudent Name (This will be used to store the student’s name).
11. Create the variable for each subjects
12. Create the variable = Average Score (This will be used to
calculate the average score.
13. Create the variable = Grade (This will be used to store the grade).
14. Set each variable to an initial value (use procedure to hold this repeated step).
TeenCoders Coding Club : www.teencoders.com.ng : #8 Old Aba Road, PH : 08039558839
STUDENT NAME:___________________________________ DATE:__________________
15. Get the score of the student in each subject (use procedure to hold this repeated step).
16. Calculate and set the average.
17. Grade the student
a. Based on the grade, change the teacher’s costume, make the teacher to talk.

4. Settings
12. Subject: Maths, English, Science, CRK, ICT.
Grade: A, B, C, D, F.
13. A = 80% - 100% (greater than 79.99% and less than 100.01%)
14. B = 70% - 79% (greater than 69.99% and less than 79.999%)
15. C = 60% - 69% (greater than 59.99% and less than 69.999%)
16. D = 40% - 59% (greater than 39.99% and less than 59.999%)
17. F = 0% - 39% (greater than -0.01% and less than 39.999%)
Teacher Comments
18. A = Your GRADE is A. Excellent result! You are the best.
19. B = Your GRADE is B. Very good result. Keep it up.
20. C = Your GRADE is C. Good result. Keep improving.
21. D = Your GRADE is D. Average result. But I know you will do better.
22. F = Your GRADE is F. Below average result. You can do better.

5. Write the code (Marian)


25. When green flag clicked
26. Set (Student Name) to ()
27. Set (Maths) to (0)
28. Set (English) to (0)
29. Set (Science) to (0)
30. Set (CRK) to (0)
31. Set (ICT) to (0)
32. Set (Average Score) to (0)
33. Set (Grade) to ()
34. Ask (What’s your name?) and wait
35. Set (Student Name) to (answer)
36. Ask (Maths Score: ) and wait
37. Set (Maths) to (answer)
38. Ask (English Score: ) and wait
39. Set (English) to (answer)
40. Ask (Science Score: ) and wait
41. Set (Science) to (answer)
42. Ask (CRK Score: ) and wait
43. Set (CRK) to (answer)
44. Ask (ICT Score: ) and wait
45. Set (ICT) to (answer)
Bring out the divide operator, put 4 addition operators to the left and write 5 in the right hole.
46. Set (Average Score) to [divide [plus (Maths) + [plus (English) + [plus (Science) + [plus (CRK) + (ICT) ]]]] / (5) ]
Bring out the and operator, to the left put a greater than operator. Put Average Score to the left and type 79.99 in
the right hole of the greater than sign. Put a less than sign in the left hold of the and operator. Put Average score
to the left and type 100.01 to the right of the less than sign.
47. If [and [greater than (Average Score) > (79.99) ] and [less than (Average Score) < (100.01) ]] then
a. Set (Grade) to (A)
Bring out 3 joins

TeenCoders Coding Club : www.teencoders.com.ng : #8 Old Aba Road, PH : 08039558839


STUDENT NAME:___________________________________ DATE:__________________
b. Say [join (Student Name) [join ( , your average score is: ) [join (Average Score) ( . Your GRADE is A. Excellent
result! You are the best.) ]]] for (10) seconds.
Else
If [and [greater

TeenCoders Coding Club : www.teencoders.com.ng : #8 Old Aba Road, PH : 08039558839


STUDENT NAME:___________________________________ DATE:__________________

.
.

TeenCoders Coding Club : www.teencoders.com.ng : #8 Old Aba Road, PH : 08039558839


STUDENT NAME:___________________________________ DATE:__________________

TeenCoders Coding Club : www.teencoders.com.ng : #8 Old Aba Road, PH : 08039558839

You might also like