exercise moving undraw *as discussed above at where to split the loop (page )the basic loop logic works whether the poly undraw(call is at the beginning or end of the loop write variation makepoly py that makes the code work the other waywith the poly undraw(at the beginning of the loop do not change or move any other statement in the loop the new place to cut the loop does affect the code before and after the loop in particularthe extra statement drawing poly is not needed after the loop is completed make other changes to the surrounding code to make this work hints make path exercise *write program that is outwardly very similar to makepoly pyand call it makepath pywith function pathhere the only outward difference between polyhere and pathhere is that while the first creates closed polygonand returns itand the new one creates polygonal pathwithout the final point being automatically connected to the first pointand list of the lines in the path is returned internally the functions are quite different the change simplifies some thingsno need to undraw anything in the main loop just draw the latest segment each time going from the previous point to the just clicked point there are complications howeveryou do need deal specially with the first point it has no previous point to connect to suggest you handle this before the main loopif the point is inside the rectangledraw the point so it is visible guide for the next point before returningundraw this initial point (the place on the screen will still be visible if an initial segment is drawn if no more points were addedthe screen is left blankwhich is the way it should beand an empty list of lines should be returned you also need to remember the previous point each time through the main loop suggest you think individually about what should happen if you stop the drawing when the firstsecond or third point is outside the rectangle also test each of those cases after the program is written in your main programcall the makepath function two times use the list of lines returned to loop through and change the color of all the lines in one path and the width of the lines in the other path portion of sample image from this program is shown below the basic issue is similar to the old versionthe undraw is not always needed at the beginning in this case in this place it is not needed the first time through the loop the two basic approaches considered for the previous version still work heremake an extra compensating action outside the loop or break into cases inside the loop further hintit is legal to draw polygon with an empty vertex list nothing appears on the screen more on flow of control