Chapter 10 ExercisesΒΆ

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

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

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

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

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

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

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

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

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

    Show Comments
  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.

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

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

    Show Comments
  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.

    Show Comments
  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.

    Show Comments
  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.

    Show Comments
  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)

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

    Show Comments
  18. Create a procedure that takes in a turtle and integer parameter. The procedure should stamp a turtle shape into a circle in 20 steps with the forward number being equal to the parameter.

    Show Comments
  19. Write a procedure that takes a turtle and a number of sides as parameters and draws a polygon with that number of sides.

    Show Comments
  20. Write a procedure that takes a turtle, an int for the number of sides for a polygon, and an int for the number of times to draw that polygon. The procedure should draw that polygon that number of times in a circular path.

    Show Comments
Next Section - Chapter 11 - Repeating Steps with Images