内容简介:hypot() 返回欧几里德范数 sqrt(x*x + y*y)。
描述
hypot() 返回欧几里德范数 sqrt(x*x + y*y)。
语法
以下是 hypot() 方法的语法:
import math math.hypot(x, y)
注意:hypot()是不能直接访问的,需要导入 math 模块,然后通过 math 静态对象调用该方法。
参数
- x -- 一个数值。
- y -- 一个数值。
返回值
返回欧几里德范数 sqrt(x*x + y*y)。
实例
以下展示了使用 hypot() 方法的实例:
#!/usr/bin/python import math print "hypot(3, 2) : ", math.hypot(3, 2) print "hypot(-3, 3) : ", math.hypot(-3, 3) print "hypot(0, 2) : ", math.hypot(0, 2)
以上实例运行后输出结果为:
hypot(3, 2) : 3.60555127546 hypot(-3, 3) : 4.24264068712 hypot(0, 2) : 2.0
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- Python 拓展之特殊函数(lambda 函数,map 函数,filter 函数,reduce 函数)
- Python 函数调用&定义函数&函数参数
- python基础教程:函数,函数,函数,重要的事说三遍
- C++函数中那些不可以被声明为虚函数的函数
- 017.Python函数匿名函数
- 纯函数:函数式编程入门
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Effective JavaScript
David Herman / Addison-Wesley Professional / 2012-12-6 / USD 39.99
"It's uncommon to have a programming language wonk who can speak in such comfortable and friendly language as David does. His walk through the syntax and semantics of JavaScript is both charming and h......一起来看看 《Effective JavaScript》 这本书的介绍吧!