5.10. ExercisesΒΆ

  1. Write a program that prints We like Python's turtles! 100 times.

    Show Comments
  1. Turtle objects have methods and attributes. For example, a turtle has a position and when you move the turtle forward, the position changes. Think about the other methods shown in the Summary of Turtle Methods page. Which attibutes, if any, does each method relate to? Does the method change the attribute?

  1. Use for loops to make a turtle draw these regular polygons (regular means all sides the same lengths, all angles the same):

    • An equilateral triangle

    • A square

    • A hexagon (six sides)

    • An octagon (eight sides)

    # draw an equilateral triangle
    import turtle
    wn = turtle.Screen()
    norvig = turtle.Turtle()
    for i in range(3):
        # the angle of each vertice of a regular polygon
        # is 360 divided by the number of sides
    # draw a square
    import turtle
    wn = turtle.Screen()
    kurzweil = turtle.Turtle()
    for i in range(4):
    # draw a hexagon
    import turtle
    wn = turtle.Screen()
    dijkstra = turtle.Turtle()
    for i in range(6):
    # draw an octogon
    import turtle
    wn = turtle.Screen()
    knuth = turtle.Turtle()
    for i in range(8):
    Show Comments
  1. Write a program to draw a shape like this:

    Show Comments
  1. Write a program to draw a face of a clock that looks something like this:

  1. Write a program to draw some kind of picture. Be creative and experiment with the turtle methods.

    Show Comments
  1. Create a turtle and assign it to a variable. When you print its type, what do you get?

5.10.1. Contributed ExercisesΒΆ

You have attempted of activities on this page