Practice:定义多点坐标,绘出折线,并计算起始点和终点的距离

 1 import turtle
 2 import math
 3 x1,y1 = 100,100
 4 x2,y2 = 100,-100
 5 x3,y3 = -100,-100
 6 x4,y4 =-100,100
 7 turtle.penup()
 8 turtle.goto(x1,y1)
 9 turtle.pendown()
10 turtle.goto(x2,y2)
11 turtle.goto(x3,y3)
12 turtle.goto(x4,y4)
13 distence = math.sqrt((x1-x4)**2+(y1-y4)**2)
14 turtle.write(distence)