# Chapter 10 Exercises¶

1. Fix 4 syntax errors in the code below to correctly draw a square

2. The code currently draws a square. Change it so that it draws a triangle.

3. Fix the code below to draw a rectangle. You will need to fix the indention on 3 lines.

4. Fix the errors in the code so that it draws an octagon.

5. Fill in values for x on line 5 and y on line 7 to allow the code below to correctly draw a pentagon.

6. Complete the code on lines 5 and 7 to draw a hexagon.

7. Finish the code on lines 1, 2, 3, 6 and 8 below to correctly draw a triangle.

8. Finish the code to draw a 15 sided figure with each side having a length of 40.

9. Fix the indention in the code below to correctly draw 20 pentagons.

10. The procedure below draws a square. Write code that uses the procedure to draw two squares connected by a line 50 units in length.

11. Fix the following code below to draw a circle of turtles using the stamp procedure. You will need to change 3 lines.

12. Complete the code where the x's are so that the code draws 20 triangles.

13. Rewrite the following code to create a procedure to draw a square with a turtle. Pass the turtle and the size of the square as input (parameters) to the procedure.

14. Currently, the code has a turtle drawing a straight line. Add 2 lines of code (1 before the loop and 1 in the loop) to make the turtle stamp in the line.

15. Rewrite the following code to create a procedure to draw a rectangle with a turtle. Pass the turtle and the length and width of the rectangle as parameters to the procedure.

16. Complete the code so that the turtle stamps a square pattern 20 times (it should look like a circle enclosing a couple of circles if you use a turn angle of 18)

17. Create a procedure to draw 4 turtles at the 4 corners of a square using the stamp procedure.