Python Development Course
Chapter
>
Level

Learning Loops
More complex looping

Objective

Walk through field and water crops on your way to the exit while only using no more than thirteen (14) lines of code.

To complete this level using thirteen (14) or less lines of code you must use either the for or while loops.

Use the: move_forward(), turn_left(), turn_right() functions inside the loop to move through the field. Along the way, use the water() function when standing on an X mark and facing crops to water them.

Remember, loops are written like this:

# While loop count = 0 while count < [Number of times you wish while code to loop]: [Code you wish to loop ] count += 1; # for loop for x in range([Number of times you wish for code to loop]): [Code you wish to loop ]

Use whichever loop you like, there are setups in the code editor for both so erase the one you are not going to use.

Code book