What does pow mean in python

Release: 2019-07-23 13:44:14
Original
10958 people have browsed it

What does pow mean in python

The pow() function in Python returns the value of xy (x raised to the yth power).

Syntax:

The following is the syntax of the math module pow() method:

import math
math.pow( x, y )
Copy after login

The built-in pow() method

pow(x, y[, z])
Copy after login

The function is Calculate the y power of , the built-in method will treat the parameter as an integer, while the math module will convert the parameter into a float.

Parameters

x -- Numeric expression. y – Numeric expression. z – Numeric expression.

Return value

Return the value of x

y

(x raised to the yth power). Example

The following shows an example of using the pow() method:

#!/usr/bin/python
# -*- coding: UTF-8 -*-
import math   # 导入 math 模块
print "math.pow(100, 2) : ", math.pow(100, 2)
# 使用内置,查看输出结果区别
print "pow(100, 2) : ", pow(100, 2)

print "math.pow(100, -2) : ", math.pow(100, -2)
print "math.pow(2, 4) : ", math.pow(2, 4)
print "math.pow(3, 0) : ", math.pow(3, 0)
Copy after login

Running results:

math.pow(100, 2) :  10000.0
pow(100, 2) :  10000
math.pow(100, -2) :  0.0001
math.pow(2, 4) :  16.0
math.pow(3, 0) :  1.0
Copy after login

More Python related technical articles , please visit the Python Tutorial

column to learn!

The above is the detailed content of What does pow mean in python. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!