0% found this document useful (0 votes)
228 views

L2 Slides - Programming Essentials in Scratch - Part I - Y7

This document introduces variables in programming. It defines a variable as a name that refers to stored data. The lesson objectives are to define variables, recognize input/process/output flow, predict outcomes of sequences including variables, and trace variable values. Activities involve predicting and investigating code involving variables, and tracing a variable to determine outputs.

Uploaded by

Mohamed Solob
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
228 views

L2 Slides - Programming Essentials in Scratch - Part I - Y7

This document introduces variables in programming. It defines a variable as a name that refers to stored data. The lesson objectives are to define variables, recognize input/process/output flow, predict outcomes of sequences including variables, and trace variable values. Activities involve predicting and investigating code involving variables, and tracing a variable to determine outputs.

Uploaded by

Mohamed Solob
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Lesson 2: Variables

Year 7 – Programming essentials in Scratch: part I


Starter activity

Variables

A variable is a name that refers to data being stored by


the computer

2
Objectives

Lesson 2 : Variables
In this lesson, you will:
● Define what a variable is
● Recognise that computers follow the control flow of input/process/output
● Predict the outcome of a simple sequence that includes variables
● Trace the values of variables within a sequence
● Make a sequence that includes a variable

3
Activity 1

Input — process — output

INPUT PROCESS OUTPUT

STORAGE 4
Activity 2

Meet Big Ed

Big Ed is your friendly chatbot.

Your task is to work in pairs to answer the


questions on the activity sheet. You’ll find
out what the code does and have the
chance to experiment with it.

Start by opening the Scratch program.

ncce.io/biged1

5
Activity 2

PREDICT

With a partner, spend time reading the code


on the right. Predict what you think will
happen.

Run the Scratch code from the link provided.

● Were your predictions correct?


● Did anything surprise you about the
code?
● Did you miss anything out?

ncce.io/biged1 6
Activity 2

Worksheet: INVESTIGATE and MODIFY

Continue with the worksheet.

Work in pairs, but complete your own


worksheet.

Follow the instructions and investigate how


the code works.

Move through the tasks independently.

Don’t wait for your teacher to instruct you to


move to the next section.

ncce.io/biged1 7
Activity 2

INVESTIGATE: Answers

How do the following two blocks relate to


each other?

When your program reaches the ask_name


block, it calls the subroutine ‘define
ask_name’.

‘define ask_name’ is a subroutine.

8
Activity 2

INVESTIGATE: Answers

What has this changed about the program


when you run it?

Why do you think this is?

Big Ed will now only say “Hello”.

As the question has not been asked,


there is no ‘answer’.

The line ‘set name to answer’ will


now give name an empty value.
9
Activity 2

INVESTIGATE: Answers

Below ‘define ask_name’, there are two


variables being used.

What are their names?

1. Answer
2. Name

10
Activity 2

INVESTIGATE: Answers

Why do you think it only says “Hello”


and not “Hello” and the name you
entered?

What can you learn from this?

It is because ‘name’ is being linked to ‘answer’ before the question is asked.

You must always set the value of a variable before using it.

11
Plenary

Trace the score variable: What will Big Ed say?

Big Ed has just arrived on a new planet


and he’s measuring the temperature of his
new environment.

Use the activity sheet to trace (keep track


of) the value of the temperature variable
on each line that it is referenced.

Fill in your activity sheet and write down


what Ed will say on each line.

12
Plenary

Trace the score variable: What will Big Ed say?

13
Plenary

Trace the score variable: What will Big Ed say?

14
Plenary

Trace the score variable: What will Big Ed say?

15
Plenary

Trace the score variable: What will Big Ed say?

16
Plenary

Trace the score variable: What will Big Ed say?

17
Summary

Next lesson

In this lesson, you… Next lesson, you will…

● Defined a variable Learn about how to control the flow of a


● Recognised that computers follow sequence using selection
the control flow of
input/process/output
● Predicted the outcome of a simple
sequence that includes variables
● Traced a variable within a sequence

18

You might also like