《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)
相关推荐
wuyk55517 分钟前
Spider-第14讲-表单提交与CSRF
前端·爬虫·python·elasticsearch·csrf
汤姆宝库1 小时前
RoPE旋转位置编码的实现与长上下文外推
python·深度学习·机器学习
用户019027581611 小时前
股票代码格式对照:各数据源代码转 AlphaFeed
python
__underline__2 小时前
冷门Python知识点005篇:list.sort( )的排序稳定性,是用0字节额外内存实现的
python·算法
贝壳6902 小时前
升到 9.13.12 我照着文档抄了两行,两次都炸了
python
VIP_CQCRE2 小时前
AI 音乐 API 上线后成本失控?用预算阈值、幂等任务和音频验收管住 Suno v6
python·api·suno·ai音乐·成本治理
2601_967980112 小时前
python list如何赋值
python·list·列表推导式·赋值·切片赋值
典学长编程3 小时前
LangGraph 快速入门:从 StateGraph 到 ReAct Agent
python·有向图·无向图·langgraph·react agent·stategraph
用户019027581616 小时前
AlphaFeed 查不到代码返回空?非法/缺后缀 symbol 的行为与处理
python
isfox6 小时前
Python 单元测试:别再用 print 调试了,写个测试一劳永逸
python