Teacher's Guide

Chapter 5 / Level 2: Combining lists

Teaching Objective:

  • Student learns how to combine lists
  • Learn how to use the combine() function
  • Learn the dynamics of how to use lists with functions

Guide

In order to complete the level the student must grab all the items put them in lists and mix them together. Grab the milk and cream items and put them in a list together.

liquids = []
liquids.append(3) # milk jars
liquids.append(2) # cream jars

After the list is complete, grab the vegetables next and add them to a list too.

vegetables = [3, 5] # lettuces , radishes

Once all items are picked up and lists are made, add the lists together

mixture = liquids + vegetables

Afterwards head for the X mark and use the combine() function to mix the items into the large glass jar.

player.combine(mixture)

Map overview and path

Map overview and path

Code Solution

import player

player.turn_right()
player.move_forward(2)
player.turn_left()
player.move_forward(5)
liquids = []
liquids.append(3)
liquids.append(2)
player.turn_left()
player.move_forward(8)
player.turn_left()
player.move_forward(5)
player.turn_left()
player.move_forward()
player.turn_left()
player.move_forward(5)
vegetables = [3, 5]
mixture = liquids + vegetables
player.turn_right()
player.move_forward(4)
player.turn_left()
player.combine(mixture)
Chapter 5 / Level 2: Combining lists | Teacher's Guide