Small basic lesson 2 (Mr Evlat)

1. In the code on the left why is the turtle sprite not moving?

2. In the code on the right what line of code has made the turtle sprite stop drawing?
1 / 14
volgende
Slide 1: Open vraag
ComputingLower Secondary (Key Stage 3)

In deze les zitten 14 slides, met interactieve quizzen en tekstslides.

time-iconLesduur is: 50 min

Onderdelen in deze les

1. In the code on the left why is the turtle sprite not moving?

2. In the code on the right what line of code has made the turtle sprite stop drawing?

Slide 1 - Open vraag

Deze slide heeft geen instructies

Do Now answer
1. There is no argument for distance in the brackets
2. Turtle.PenUp has been used which lifts the pen up to stop drawing as the turtle moves

Slide 2 - Tekstslide

Deze slide heeft geen instructies

Lesson objectives 

Conquer: Understand the concept of variables
 
Aspire Higher: To apply variable knowledge to create a chat bot





 
 
Aspire: Create a set of loops to make a program more efficient.

Slide 3 - Tekstslide

Deze slide heeft geen instructies

W
What is a Variable?
A variable is a named box in the computer’s memory where we can store a value so we can use it later.

  • Think of a variable like a labelled box.
  • The label is the name of the variable.
  • The item you put in the box is the value.
  • Our variable name should relate to the value stored inside. 
Age
13

Slide 4 - Tekstslide

Deze slide heeft geen instructies

Hearts
Hunger
Wood
Name
8
5
22
Steve

Slide 5 - Tekstslide

“In Small Basic, we create a variable by choosing a name, then using the equals symbol (=) to store a value inside it.”

Slide 6 - Tekstslide

Deze slide heeft geen instructies

Type this code, instead of my name use your name
instead! What does this code do?
  • We have created a variable named "name" and assigned our value e.g "Mr Evlat". This is then printed onto the screen using TextWindow.WriteLine(name)
Small basic
Name
Mr Evlat

Slide 7 - Tekstslide

Deze slide heeft geen instructies

What 2 things does a Variable Need?

Slide 8 - Open vraag

Deze slide heeft geen instructies

Inputs
An input is information that the user gives to the computer, which the program can then use later in the program.  Test out this code to see what it does.
  • The variable "name" is assigned whatever value the user (you) enters using the line TextWindow.Read() . This is then printed on the screen with the message "Hello + (whatever name you entered)"
name
(User input)

Slide 9 - Tekstslide

Deze slide heeft geen instructies

A

Slide 10 - Tekstslide

Deze slide heeft geen instructies

In your partners or groups use this code to program your own chatbot. Create the following questions and print the responses! Only Partner A should write the code, Partner B should tell them what to write

  1. Ask your age
  2. Ask your favourite food
  3. Ask your favourite Show/film
Small basic
Glossary

Slide 11 - Tekstslide

TextWindow.WriteLine("What is your name?")
name = TextWindow.Read()
TextWindow.WriteLine("Hello " + name)
What is the purpose of this line of code?

TextWindow.WriteLine(text)
A
Writes text to screen
B
Stores information
C
Changes the colour of the pen
D
To change the value stored in the variable "text"

Slide 12 - Quizvraag

Deze slide heeft geen instructies

What is the purpose of this line of code?

TextWindow.Read()
A
Saves information
B
Writes text to screen
C
Allows the user to input information
D
Moves the turtle

Slide 13 - Quizvraag

Deze slide heeft geen instructies

A variable is a ________ box in the computer’s __________ where we can store a ______ so we can use it later.
named
memory
value

Slide 14 - Sleepvraag

Deze slide heeft geen instructies