0% found this document useful (0 votes)
47 views2 pages

CL4 CH5 Addition-Bot-2

Addition sheet

Uploaded by

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

CL4 CH5 Addition-Bot-2

Addition sheet

Uploaded by

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

ACTIVITY SHEET

Session 5 Addition Bot

SESSION 5
Addition Bot

In this activity, we learn how to make perform arithmetic operations in Coding. We will create the
calculator which adds two numbers.

This activity sheet belongs to _______________________________________________________________

MATERIAL REQUIRED
□ Computer / Tab / Laptop with PictoBlox Installed.

ARITHMETIC OPERATORS
There are four main arithmetic operators in PictoBlox:
Addition, Subtraction, Multiplication, and Division.

ASKING A QUESTION
To make the sprite ask a question, we will use an ask
block from the Sensing palette. It will ask the user
whatever you write inside it, wait for user input, and
then store that input in the answer block.

STEP-BY-STEP
Follow the steps below:
1. Create a New file in PictoBlox.
1.1 Open PictoBlox and create a new file.
1.2 Select the coding environment as Block Coding.
2. Click the Choose a Backdrop button. Select the Forest backdrop
from the library.
3. Add two ask () and wait blocks to get the input from users for
Number 1 and Number 2. Using the ask () and wait block will add
an input box (with the specified text above it) at the bottom of the
Stage. The user can write the answer and submit it, which is then stored in the answer block.

Powered by STEMpedia https://ai.thestempedia.com 1


Session 5 Addition Bot

4. Next, make 3 variables from Variable palette:


4.1. Number 1: To store the value of the first input.
4.2. Number 2: To store the value of the second input.
4.3. Result: To store the final output value.
5. Place two set () to () blocks from Variable palette, one
below each ask () and wait block to store the input
values in Number 1 and Number 2.

STEP 4

STEP 5

6. Place another set () to () block at the end and choose Result from its drop-down. Place a () + () block
(addition Operator block) in the white space and add Number 1 and Number 2.
7. Make Tobi say the result out loud using the say () for () seconds block.
8. Complete the script by adding a when flag clicked block.

FINAL SCRIPT

9. Maximize the stage and test!

SAVING THE PROGRAM


Save the project file as Addition Bot. Check the first activity sheet if you missed how to save the project.

Powered by STEMpedia https://ai.thestempedia.com 2

You might also like