Answer
import turtle
# 1st hexagon
turtle.penup()
turtle.goto(-50, 100)
turtle.pendown()
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
# 2nd hexagon
turtle.penup()
turtle.goto(-255, 100)
turtle.pendown()
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
# 3rd hexagon
turtle.penup()
turtle.goto(-255, 280)
turtle.pendown()
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
# 4th hexagon
turtle.penup()
turtle.goto(-50, 280)
turtle.pendown()
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.done() # pause turtle window
Work Step by Step
# (Turtle: draw four hexagons) Write a program that draws four hexagons in the
# center of the screen, as shown in Figure 2.4b.
import turtle
# 1st hexagon
turtle.penup()
turtle.goto(-50, 100)
turtle.pendown()
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
# 2nd hexagon
turtle.penup()
turtle.goto(-255, 100)
turtle.pendown()
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
# 3rd hexagon
turtle.penup()
turtle.goto(-255, 280)
turtle.pendown()
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
# 4th hexagon
turtle.penup()
turtle.goto(-50, 280)
turtle.pendown()
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.done() # pause turtle window