5.6. Bob Builds a House

Let’s combine the square and triangle code to create a drawing of a simple house.

Note

The program below has blank lines between the lines of code. The computer ignores the blank lines. We add blank lines to programs to group lines that are working together such as the lines below that draw a square. Often a comment (starts with a #) is used before a several lines of code to explain the purpose of the code.

Let’s imagine going on to make another partial square along the slope, to create a “chimney.”

../_images/turtle-house.png

Align the program pieces below to make the house and chimney figure above. Draw the square first for the main part of the house, next draw the roof, and finally draw the chimney.

Let’s make another square inside the house, to create a “window.”

../_images/turtle-house2.png

Align the program pieces below to make the house and window figure above. Draw the square first for the main part of the house, next draw the roof, and finally draw the window.

Note

Discuss topics in this section with classmates.

Show Comments
You have attempted of activities on this page