《python语言程序设计》2018版第6章第20题几何问题,显示角 使用distance函数计算两点之间的距离

python 复制代码
def distance(x1, y1, x2, y2):
    x1, y1 = eval(input("Enter x1 and y1 for point1: "))
    x2, y2 = eval(input("Enter x2 and y2 for point2: "))

    distance_t = ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)) ** 0.5

    print("The distance between the two points is", distance_t)
相关推荐
用户6757049885021 分钟前
Python 装饰器很难?那是你没看到这篇文章!
后端·python
码界筑梦坊16 分钟前
124-基于Python的航空旅客满意度数据可视化分析系统
开发语言·python·信息可视化·数据分析·flask·毕业设计
星越华夏20 分钟前
PPTX判断包含图表id
python·pandas
梦想不只是梦与想20 分钟前
Python 中的流程控制语句
python·流程控制·循环·条件判断·if
dinl_vin21 分钟前
FastAPI 系列(一)· 初体验——从 Spring Boot 工程师视角认识 FastAPI
后端·python·fastapi
AI玫瑰助手22 分钟前
Python流程控制:pass语句的作用与使用场景
开发语言·python·信息可视化
Metaphor69225 分钟前
使用 Python 设置 Word 文档文本的颜色
python·word
肥胖小羊43 分钟前
基于状态机的客户生命周期流转与自动化触达引擎实现
开发语言·python
深度学习lover44 分钟前
<数据集>yolo 易拉罐识别<目标检测>
人工智能·python·yolo·目标检测·计算机视觉·易拉罐识别