《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)
相关推荐
蒸鱼Yuzheng1 小时前
设备端性能工件可靠导出:断点续传、哈希、manifest 与失败恢复
android·自动化测试·python·adb·数据完整性
圆圆讲门店2 小时前
挑选同城获客服务机构时需要考量的核心因素都有哪些?
大数据·网络·人工智能·python
傻啦嘿哟2 小时前
Python的默认参数把我坑惨了,原来写[]和写None的区别这么大
开发语言·python·机器学习
微小冷2 小时前
Python凸优化cvxpy初步
python·机器人·凸优化·数学规划·cvxpy
在世修行3 小时前
干货:显式映射 vs 自动判据
python·插件
xzal123 小时前
Python之简单理解栈和队列
python
lupai3 小时前
维修保养记录精准版 API 对接实战指南
数据库·python
水水不水啊3 小时前
告别杂乱的调试窗口:我用 Python + WebView 写了一个现代化串口助手
python·测试工具·嵌入式·嵌入式开发·串口调试·串口助手
三水写代码4 小时前
手写一个 Claude Code(1):从 Agent Loop 到工具、权限、Hooks 与任务规划
python·ai编程·claude·ai agent·claudecode
m0_547486664 小时前
《Python高级编程》全套PPT课件2026(北京理工大学)
python·pycharm