《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)
相关推荐
小羊没烦恼!17 分钟前
Windows Azure Platform体验(1):Windows Azure
java·大数据·后端·python·flask·word·.net
JWASX20 分钟前
【agent 开发】agent 开发学习 - LangChain(1)
python·学习·agent
jason.zeng@150220726 分钟前
(五)多轮对话上下文,实现交互。
python·交互·llama
wangchunyu11426 分钟前
食韵味简 —— 免费开源的中式菜谱 API 服务
python·django·开源
znx93926 分钟前
因子分析:量化交易的底层核心与盈利逻辑基石
人工智能·python·机器学习·期魔方
jason.zeng@150220732 分钟前
(十)分层架构的多文件工程
python·架构·prompt·交互·ai编程·llama
小小张说故事32 分钟前
Python 装饰器到底是个啥?从 @ 符号到手写一个,5 个例子讲透
后端·python
haerapi42 分钟前
KingbaseES 全文检索实战之前:先建立中文搜索的可解释基线
开发语言·python·全文检索
专业程序开发源1 小时前
SSM笔记本在线销售系统32649-计算机课程设计、毕业设计
java·spring boot·后端·python·django·php·课程设计
脉动数据行情11 小时前
Python asyncio 异步实现比特币 BTC 实时行情监听 高并发版
开发语言·python·区块链