Teacher's Guide

Chapter 1 / Level 2: Movement with Functions

Teaching Objective:

  • Student must continue to familiarize themselves with how the code editor operates
  • Learn to write code: player.turn_left() and player.turn_right()
  • Set expectations for the flow of each exercise

Guide

In order to make it to the exit you need to navigate your character across the path. Use the functions turn_left() and turn_right() to rotate the character left or right.

player.turn_left()
player.turn_right()

Once you’re facing the direction you want to go use function move_forward() to move forward in that direction. To move further in your facing direction, add the number of steps you would like to take inside it’s parenthesis.

player.move_forward(2)

Map overview and path

Map overview and path

Code Solution

import player

player.move_forward()
player.move_forward()
player.turn_left()
player.move_forward()
player.move_forward()
player.turn_right()
player.move_forward()
player.move_forward()
player.move_forward()
Chapter 1 / Level 2: Movement with Functions | Teacher's Guide