Teacher's Guide

Chapter 2 / Level 2: Commenting Code

Teaching Objective:

  • Player learns how to comment code and it’s syntax
  • Understand the utility of comments for troubleshooting

Guide

In this level the solution is already written in the code editor, in order to proceed you must make corrections to the code by commenting unnecessary code and un-commenting relevant code that’s already commented. You can do this by adding or removing the # sign, also known as a pound.

Once the code has been corrected the player character will walk towards the exit and complete the level.

Map overview and path

Map overview and path

Code Solution

import player

player.move_forward(3)
player.turn_right()
player.move_forward(3)
player.turn_right()
player.move_forward()
player.turn_left()
player.move_forward(2)
player.turn_left()
player.move_forward(8)
player.push()
player.move_forward()
player.turn_left()
player.move_forward(2)
player.turn_left()
player.move_forward(2)
player.turn_right()
player.move_forward(2)
player.turn_right()
player.move_forward()
player.turn_left()
player.move_forward(2)
player.turn_right()
player.move_forward(3)
player.turn_right()
player.move_forward()
Chapter 2 / Level 2: Commenting Code | Teacher's Guide