Teacher's Guide

Chapter 5 / Level 1: Numeric Lists

Teaching Objective:

  • Learn how lists can be useful
  • Learn how to create and populate lists
  • Learn how lists can interact with other elements in game

Guide

Walk through the barn and collect all the eggs in the barn. There are three classes of eggs: blue eggs, red eggs and green eggs.

After collecting all eggs, place them inside a list:

eggs = []
eggs.append(5) # blue eggs
eggs.append(3) # red eggs
eggs.append(2) # green eggs

# Or

blue_eggs = 5
red_eggs = 3
green_eggs = 2

eggs = []
eggs.append(blue_eggs)
eggs.append(red_eggs)
eggs.append(green_eggs)

Once your list is set up, head for the X mark, face the container and store the list inside the container using the place() function.

player.place(eggs)

Map overview and path

Map overview and path

Code Solution

import player

player.turn_right()
player.move_forward(11)
player.turn_left()
player.move_forward(2)
player.turn_left()
player.move_forward(3)
player.turn_right()
player.move_forward(2)
player.turn_left()
player.move_forward(4)
player.turn_left()
player.move_forward(5)
player.turn_left()
player.move_forward(2)
player.turn_right()
player.move_forward()
blue_eggs = 5
red_eggs = 3
green_eggs = 2
eggs = []
eggs.append(blue_eggs)
eggs.append(red_eggs)
eggs.append(green_eggs)
player.place(eggs)
Chapter 5 / Level 1: Numeric Lists | Teacher's Guide