Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please use Python to answer this question. The project is to print a 4 by 4 squa

ID: 3724087 • Letter: P

Question

Please use Python to answer this question.

The project is to print a 4 by 4 square, each square of which is the repeat pattern (see next paragraph), and where colors alternate from square to square along both the rows and the columns, somewhat like a chessboard. You can alternate colors by using the same colors in each square but shifting which colors are used in which pattern areas. Or you can use entirely different colors from square to square.

You must use helper functions for this project. Make sure your functions include size & color parameters. This will allow you to scale the size & change the colors of the pattern that the turtle module generates. Your functions must have size and color parameters so that you can scale your output (make it smaller or larger) and change the colors.

Hint:

import turtle

.

.

The Pattern's picture:

Explanation / Answer

import turtle
turtle.pensize(3) # Set pen thickness to 3 pixels
turtle.penup() # Pull the pen up
turtle.goto(-120, -120)
turtle.pendown() # Pull the pen down
  
turtle.color("black")
for i in range(5):
turtle.forward(240)
turtle.left(90)
turtle.penup()
turtle.forward(24)
turtle.pendown()
turtle.left(90)
turtle.forward(240)
turtle.right(90)
turtle.penup()
turtle.forward(24)
turtle.pendown()
turtle.right(90)

turtle.forward(240)
turtle.right(90)
turtle.right(90)
turtle.forward(240)
turtle.right(90)
turtle.right(90)

turtle.color("black")
for i in range(5):
turtle.right(90)
turtle.forward(240)
turtle.left(90)
turtle.penup()
turtle.forward(24)
turtle.pendown()
turtle.left(90)
turtle.forward(240)
turtle.right(90)
turtle.penup()
turtle.forward(24)
turtle.pendown()

turtle.right(90)
turtle.forward(240)
turtle.hideturtle()
turtle.done()