graphics – Could someone explain how I can use parameters to shorten my code in python

A closure would work well here. Set the the Fill, Outline and drawing GraphWin in the enclosing scope. Then you’ll have a function that takes two points and draws with the same colors over and over.

Using code would look like this:

def diSquares():

    win = GraphWin('Coursework', 500, 500)

    redBlackRectangle = coloredRectangle('red', 'black', win)

    redBlackRectangle(Point(0,400),Point(100,500))
    redBlackRectangle(Point(100,300),Point(200,400))
    redBlackRectangle(Point(200,200),Point(300,300))
    redBlackRectangle(Point(300,100),Point(400,200))
    redBlackRectangle(Point(400,0),Point(500,100))