《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)
相关推荐
划水的code搬运工小李8 小时前
自制py功能包解析IMU航迹推算
python·imu·航迹推算
玖疯子9 小时前
TCP/IP协议栈深度解析技术文章大纲
python·scikit-learn·pyqt·pygame
sunfove9 小时前
Python 自动化实战:从识图点击、模拟真人轨迹到封装 EXE 全流程教学
开发语言·python·自动化
傻啦嘿哟9 小时前
Python网页自动化操作全攻略:从入门到实战
开发语言·python·自动化
啦哈拉哈9 小时前
【Python】知识点零碎学习4
python·学习·算法
qwerasda1238529 小时前
车牌字符识别与定位技术:多国家车牌检测与识别系统
python
独行soc9 小时前
2026年渗透测试面试题总结-3(题目+回答)
网络·python·安全·web安全·渗透测试
sg_knight9 小时前
工厂方法模式(Factory Method)
java·服务器·python·设计模式·工厂方法模式·工厂模式
西红市杰出青年9 小时前
Python异步----------信号量
开发语言·python
tianyuanwo9 小时前
深入浅出SWIG:从C/C++到Python的无缝桥梁
c语言·c++·python·swig