# drawing.py # ---------- # By Kayden # # (Briefly describe what this program does.) from turtle import * from math import sqrt def fly(distance): "The turtle moves without drawing for a specified distance." penup() forward(distance) pendown() def square(size): "This function defines the drawing of a square with an iteration." for i in range(4): forward(size) right(90) def pattern(): "The function draws a square in a square 3 times." left(45) square(50) fly(5) right(90) fly(5) left(90) square(40) fly(5) right(90) fly(5) left(90) square(30) def rotateright(): "The turtle draws the pattern then moves and rotates right." pattern() left(135) fly(15) right(90) fly(70) right(90) def rotateleft(): "The turtle draws the pattern then moves and rotates left." pattern() right(45) fly(55) left(90) fly(70) left(90) fly(71) left(180) def drawright(): "The turtle draws squares to the right." for i in range(5): pattern() left(135) fly(85) right(180) def drawleft(): "The turtle draws squares to the left." for i in range(5): pattern() right(45) fly(57) def draw(): "The turtle draws two rows of squares per cycle." drawright() rotateright() drawleft() rotateleft() "The turtle starts at a specific point and facing a specific direction, then performs the draw function." penup() goto(-180,180) pendown() left(180) for i in range(3): draw() input()