The use of POW in Python __python

Source: Internet
Author: User
Tags pow in python
Python pow () function

Python Digital Description

The Pow () method returns the value of XY (Y-second side of X). Grammar

The following is the syntax for the Math Module POW () method:

Import Math

Math.pow (x, y)

Built-in POW () method

Pow (x, y[, z])

The function is the Y-order of the computed x, and if z is present, the result is modulo, which is equivalent to POW (x,y)%z

Note: Pow () is called directly from the built-in method, and the built-in method takes the argument as an integer, and the math module converts the argument to float. parameter x--numeric expression. Y--numeric expression. Z--Numeric expression. The return value returns the value of x Y (Y-second side of X). instance

The following shows an example of using the POW () method: #!/usr/bin/python
#-*-Coding:utf-8-*-

Import Math # importing Math module

Print "Math.pow (2):", Math.pow (100, 2)
# Use the built-in to see the difference between output results
Print "POW (2):", pow (100, 2)

Print "Math.pow (2):", Math.pow (100,-2)
Print "Math.pow (2, 4):", Math.pow (2, 4)
Print "Math.pow (3, 0):", Math.pow (3, 0)

The above instance runs after the output is:

Math.pow (2):  10000.0
Pow (2):  10000
Math.pow (2):  0.0001 Math.pow
(2, 4):  16.0
Math.pow (3, 0):  1.0

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.