project # elsepointstodelete append((startxy)elif orientation ='horizontal'go up one path from the start pointand see if we can remove this segmentfor changex in (- ) startx while width +changex if (canvas[(xstarty )=black and canvas[(xstarty )=black)we've found four-way intersection break elif ((canvas[(xstarty )=white and canvas[(xstarty )=blackor (canvas[(xstarty )=black and canvas[(xstarty )=white))we've found -intersectionwe can' delete this segmentcandeletesegment false break elsepointstodelete append((xstarty)if not candeletesegmentcontinue get new random start point break move on to delete the segment if we can delete this segmentset all the points to whitefor xy in pointstodeletecanvas[(xy)white add the border linesfor in range(width)canvas[( )black top border canvas[(xheight )black bottom border for in range(height)canvas[( )black left border canvas[(width )black right border paint the rectanglesfor in range(numberofrectanglestopaint)while truestartx random randint( width starty random randint( height if canvas[(startxstarty)!whitecontinue get new random start point elsebreak flood fill algorithmcolortopaint random choice([redyellowblueblack]pointstopaint set([(startxstarty)]while len(pointstopaint