Teacher's Guide
Chapter 2 / Level 5: Number Variables
Teaching Objective:
- Student is introduced with data storage concepts
- Learns the syntax on how variables are written
- Makes a connection with items in the level and the applications of data storage
Guide
Variables are an easier way to identify objects in game, you can name a variable anything and they can store different types of numbers and text. In this exercise, collect all planks and bricks and store the total amount of collected items inside a variable. The example below shows how they are stored, the variable is named planks and the number is the amount of planks collected.
planks = 7
Remember, you must collect all planks and bricks and assign them to their own variable.
planks = 7
.....
bricks = 6
Map overview and path

Code Solution
import player
player.turn_right()
player.move_forward(3)
player.turn_left()
player.move_forward(4)
player.turn_left()
player.move_forward(6)
player.turn_left()
player.move_forward(3)
player.turn_left()
player.move_forward(5)
player.turn_left()
player.move_forward(2)
player.turn_left()
player.move_forward(4)
planks = 7
bricks = 6