def turtlepetal(turtle, radius, theta): pd(turtle) shape(turtle, radius=radius, theta=theta) lt(turtle, 180.0-theta) shape(turtle, radius=radius, theta=theta) lt(turtle, 180.0-theta) pu(turtle)
def turtlepie(turtle, shapesides=5, sidelength=50): pd(turtle) for bagels in range(shapesides): turtleturning(turtle, shapesides, sidelength) fd(turtle, sidelength) lt(turtle, 360.0/shapesides*((shapesides*3 - (shapesides - 4))/8.0)) base = 2*sidelength*math.sin((math.radians(360.0/shapesides))/2) shape(turtle, shapesides, base) pu(turtle) nextpie(turtle, shapesides)