Question: 1.36. Write a function that draws a series of 10 squares, with each square being 5 pixels smaller on each side. The squares should all
1.36. Write a function that draws a series of 10 squares, with each square being 5 pixels smaller on each side. The squares should all start at the same location.
import turtle
fred=turtle.Turtle()
def drawSquare(myTurtle, sideLength):
myTurtle.forward(sideLength)
myTurtle.right(90)
myTurtle.forward(sideLength)
myTurtle.right(90)
myTurtle.forward(sideLength)
myTurtle.right(90)
myTurtle.forward(sideLength)
myTurtle.right(90)
def drawNestedSquares(myTurtle):
for i in range(200, 150, -5):
drawSquare(myTurtle,i)
drawNestedSquares(fred)
1.37. Redo 1.36 so that the squares are all centered.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
