import numpy import turtle def line(p,q): turtle.penup() turtle.goto(p) turtle.pendown() turtle.goto(q) n=int(input("n in polygon equal:")) poly=[0] poly=poly*(n+1) poly[0]=1 poly[-1]=-100**n root=numpy.roots(poly) root=root.tolist() point=[] for x in root: point.append((round(x.real),round(x.imag))) r1=[x for x in point if x[0]>=0 and x[1]>=0] r2=[x for x in point if x[0]<0 and x[1]>=0] r3=[x for x in point if x[0]<0 and x[1]<0] r4=[x for x in point if x[0]>=0 and x[1]<0] r1.sort() r1.reverse() r2.sort() r2.reverse() r3.sort() r4.sort() sortpoint=[] sortpoint=r1+r2+r3+r4 p=sortpoint[0] for q in sortpoint: line(p,q) p=q line(sortpoint[0],p)