from cs1graphics import * numLevels = 8 # number of levels unitSize = 12 # the height of one level screenSize = unitSize * (numLevels + 1) paper = Canvas(screenSize, screenSize) small = unitSize/2 # minimal padding big = screenSize-unitSize/2 # screensize - padding poly = Polygon(Point(small,big), Point(big,big)) # bottom edge points poly.setFillColor('gray') x = big # placement of top-right point y = small # placement of top-right point # add two points for each level for level in range(numLevels): poly.addPoint(Point(x,y)) x -= unitSize poly.addPoint(Point(x,y)) y += unitSize # move downward for next level paper.add(poly)