定义多个坐标_用线连接起来_求起点到终点的距离
# 定义多个坐标_用线连接起来_求起点到终点的距离
import turtle
import math
# 定义多个坐标
x1, y1 = 100, 100
x2, y2 = 100, -100
x3, y3 = -100, -100
x4, y4 = -100, 100
# 用线将点连起来
turtle.width(10) # -- 设置线的宽度
turtle.goto(0, 0)
turtle.penup() # -- 抬起笔
turtle.goto(x1, y1)
turtle.pendown() # -- 落笔
turtle.circle(50) # -- 画圆
turtle.goto(x2, y2)
turtle.goto(x3, y3)
turtle.goto(x4, y4)
turtle.circle(50)
# 求起点到终点的距离
distance = math.sqrt((x4-x1)**2 + (y4-y1)**2)
turtle.write(distance)
主要是测试博客用的,哈哈