Teacher's Guide
Chapter 7 / Level 2: Function arguments
Teaching Objective:
- Student learns how to use arguments with functions
- Leans how to package loops inside a function
- Understands how a custom function can be used dynamically throughout a level
Guide
In order to complete the level, the student must water all the crops writing no more than 13 lines of code. To do this, they need to create a custom function and add a for loop that you can manipulate using arguments.
def water_crops(count):
for x in range(count):
player.move_forward(2)
player.turn_left()
player.water()
player.turn_right()
Use this function three times throughout the level each time entering a different value to the argument count . Do it corresponding to the number of X marks in a row, like this: water_crops(4) .
By using this function to it’s fullest you will be able to complete the level writing no more than 13 lines of code.
Map overview and path

Code Solution
import player
def water_crops(count):
for x in range(count):
player.move_forward(2)
player.turn_left()
player.water()
player.turn_right()
player.turn_left()
water_crops(4)
player.turn_right()
water_crops(2)
player.turn_right()
water_crops(3)