《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)
相关推荐
汤姆小白4 小时前
01-环境搭建与项目导览
人工智能·python·机器学习·numpy
向日的葵00610 小时前
langchain的Tools教程(三)
python·langchain·tools
言乐612 小时前
Python实现可运行解密游戏游戏框架
python·游戏·小程序·游戏程序·关卡设计
YUS云生12 小时前
Python学习笔记·第31天:FastAPI入门——路由、路径参数、查询参数与请求体
笔记·python·学习
智写-AI12 小时前
真实有效的免费降英文AI工具服务商
人工智能·python
yuhuofei202113 小时前
【Python入门】了解掌握Python中函数的基本使用
python
白帽小阳14 小时前
2026前端面试题!(附答案及解析)
javascript·网络·python·安全·web安全·网络安全·护网行动
乱写代码15 小时前
Python开发技巧--类型注解Literal
python
卷无止境15 小时前
Python FFI 技术深度解析:ctypes、cffi 与 pybind11 的性能差异与实践挑战
后端·python