Noskes 0 Newbie Poster

Hi, I'm currently trying to create a Pattern on python which I'm really struggling to figure out. I'm trying to recreate the patch in the picture I've uploaded however I can't figure out where I'm going wrong. I'm really confused and I'd really appreciate it if someone could help me.

Thanks alot

from graphics import*
def main():
    win = GraphWin("Patch", 500, 500)
    drawPatch(win, 100, 100)
def drawPatch(win, x, y):
    for i in range(10):
        for j in range(5):
            if (i + j) % 2 == 0:
                background = Rectangle(Point(0,0), Point(100,100))
                background.setFill("white")
                background.draw(win)
                topLeftX = x + i * 10
                topLeftY = y - j * 20
                rectangle = Rectangle(Point(topLeftX, topLeftY),
                                      Point(topLeftX + 10, topLeftY + 10))
                rectangle.setFill("red")
                rectangle.draw(win)


main()

[Click ![2811548971852432737ce663e5cc2f69](/attachments/small/4/2811548971852432737ce663e5cc2f69.png "align-left")  Here](null)