# Welcome to CS

## Exercises17.9Chapter Exercises

### 1.

There are errors in the indention in the following code. Fix it to work correctly without errors.

### 2.

The following code has some syntax errors. There are two errors, but each error is repeated multiple times due to the author copying and pasting lines of code. Fix the errors so that the code runs and draws multiple squares.

### 3.

Define a function hexagon that has a turtle’s name as its parameter. Your procedure should draw a hexagon (6 sides) where each side has a length of 50. The turtle should end up in its original position and facing. Remember the turns required (exterior angles) for a regular shape are $$360 / numSides\text{.}$$
While you are developing your procedure, we will call the hexagon procedure just once. When you are done, uncomment the code at the bottom of the program to draw 5 more hexagons.

### 4.

Complete the body of the function colorRectangle(turtleName, width, colorValue).
It should draw a rectangle that has a width specified by the parameter width and a height of 100. The turtle should be told to draw with a color specified by the parameter colorValue. The turtle should end up in its original position and facing.
Make sure to do pendown and color at the beginning of the procedure and then do penup at the end of the procedure.
There is code in the main part of the program to draw two different color rectangles. Once you get your procedure working, you can comment it out and uncomment the last 4 lines of the program to make a cool pattern.