BYU logo Computer Science

To start this assignment, download this zip file.

The following guide pages cover material needed for this assignment:

Homework 1c — While

1. Blue square

Run the code in blue_square.py. You will notice that it has an error. Can you fix it? The final world should look like this:

a blue square

2. Go to the lake

Bit wants to get to the lake. He doesn’t know how to get there. He asks for directions.

Bit: “How do I get to the lake?”

Helpful passerby: “Take a left at the stop sign.”

Write your code in go_to_lake.py. There are two starting worlds; in both worlds, bit starts at the bottom, pointing up towards a red square, with the lake on the left. This one of the starting worlds:

starting world for Bit to go to the lake

This is how it should look when Bit has arrived at the lake:

ending world for Bit to go to the lake

3. Red line

Bit needs to leave his room (black squares), finish the red line, and return to his room.

Write your code in red-line.py. This is the starting world:

starting world for this problem

This is how it should look after Bit finishes their task:

ending world for this problem

Grading

ActivityPoints
blue_square.py4
go_to_lake.py8
red_line.py8

Manual grading will focus on decomposition and correct use of while statements.