Python内置函数
- Python内置函数- __import__() 函数
- Python内置函数- zip()函数
- Python内置函数-vars()函数
- Python内置函数-type()函数
- Python内置函数-tuple 函数
- Python内置函数-super()函数
- Python内置函数-sum()函数
- Python内置函数-str()函数
- Python内置函数-staticmethod()函数
- Python内置函数-sorted()函数
- Python内置函数-slice()函数
- Python内置函数-setattr()函数
- Python内置函数-set() 函数
- Python内置函数-round()函数
- Python内置函数-reversed函数
- Python内置函数-repr()函数
- Python内置函数-range() 函数
- Python内置函数-property() 函数
- Python内置函数-print() 函数
- Python内置函数-pow() 函数
- Python内置函数-ord()函数
- Python内置函数-open()函数
- Python内置函数-oct() 函数
- Python内置函数-next() 函数
- Python内置函数-min() 函数
- Python内置函数-memoryview() 函数
- Python内置函数-max() 函数
- Python内置函数-map()函数
- Python内置函数-locals() 函数
- Python内置函数-list()函数
- Python内置函数-len()函数
- Ptyhon内置函数-iter()函数
- Python内置函数-issubclass()函数
- Python内置函数-isinstance() 函数
- Python内置函数-int() 函数
- Python内置函数-input()函数
- Python内置函数-id()函数
- Python内置函数-hex()函数
- Python内置函数-help()函数
- Python内置函数-hash() 函数
- Python内置函数-hasattr() 函数
- Python内置函数-globals() 函数
- Python内置函数-getattr() 函数
- Python内置函数-frozenset() 函数
- Python内置函数-format()函数
- Python内置函数-float()函数
- Python内置函数-filter()函数
- Python内置函数-exec()函数
- Python内置函数-eval()函数
- Python内置函数-enumerate() 函数
- Python内置函数-divmod()函数
- Python内置函数-dir()函数
- Python内置函数-dict()函数
- Python内置函数- delattr()函数
- Python内置函数-complex()函数
- Python内置函数-compile() 函数
- Python内置函数-classmethod()函数
- Python内置函数-chr() 函数
- Python内置函数-callable() 函数
- Python内置函数-bytes函数
- Python内置函数-bytearray() 函数
- Python内置函数-bool()函数
- Python内置函数-bin() 函数
- Python内置函数-ascii()函数
- Python内置函数-any() 函数
- Python内置函数-all() 函数
- Python内置函数-abs() 函数
- Python内置函数-大全
Python内置函数-pow() 函数
Python3内置函数--pow()函数
pow()函数描述:
math模块pow()方法返回 x**y(x的y次方) 的值。
内置函数pow()是计算x的y次方,如果z在存在,则再对结果进行取模,其结果等效于pow(x,y) %z
pow()函数语法:
math模块:math.pow( x, y )
内置函数:pow(x, y[, z])
注意:pow()通过内置的方法直接调用,内置方法会把参数作为整型,而 math 模块则会把参数转换为float。
pow()函数参数:
x -- 数值表达式。
y -- 数值表达式。
z -- 数值表达式。
pow()函数返回值:
math模块:返回 x**y(x的y次方) 的值。
内置:返回 x**y%z 的值。
pow()函数实例:
# math 模块pow() import math print(type(math.pow(2,3))) # <class 'float'> print(math.pow(2,3)) # 8.0 print(math.pow(5,3)) # 125.0 # 内置函数pow() print(type(pow(2,3))) # <class 'int'> print(pow(2,3)) # 8 print(pow(4,3)) # 64 print(pow(4,3,2)) # 0 print(pow(4,3,7)) # 1 print(pow(4,3,6)) # 4 print(pow(-4,3,6)) # 2 print(pow(4,-3,6)) # 报错ValueError: pow() 2nd argument cannot be negative when 3rd argument specified
最后修改:2020年3月22日 16:36