Programs

# Python pow() Function Explained

Python is one of the most significant and widely known programming languages in the modern era of technology. The Python interpreter has a wide spectrum of various built-in functions that are specifically built to perform particular tasks. This accounts for the versatility and flexibility of the programming language. One such built-in function supported by the Python interpreter is the Python power function. It is represented in general as pow(). Let us discuss more about the syntax, parameters and the return value of the Python power function in the subsequent sections.

Check out our other data science courses at upGrad.Â

## Introduction to the Python Power function:

The Python power function can be used when the user has a requirement of calculating the power of the inputs within a complex Python code. It can also be used in simpler calculations where the value of a number â€˜xâ€™ raised to the power â€˜yâ€™ is calculated. The power function in Python also allows the use of three inputs, say x, y and z. In such cases, the value returned by the function is equal to the â€˜zâ€™ modulus of â€˜xâ€™ raised to the power â€˜yâ€™. The general syntax of the Power function in Python is as mentioned below.Â

pow(x, y[, z])

The syntax will be pow(x,y) when only two input parameters are used.

## Explore our Popular Data Science Courses

 Executive Post Graduate Programme in Data Science from IIITB Professional Certificate Program in Data Science for Business Decision Making Master of Science in Data Science from University of Arizona Advanced Certificate Programme in Data Science from IIITB Professional Certificate Program in Data Science and Business Analytics from University of Maryland Data Science Courses

### Python Power function parameters:

Now that the basics of the power function in Python are thoroughly discussed let us look into the details of the parameters used in the Power function. The Python power function permits a maximum of three input parameters.

• The parameter â€˜xâ€™: It is a compulsory variable and represents the number whose power is to be determined.
• The parameter â€˜yâ€™: It is also an obligatory input parameter. It represents the number to which the parameter â€˜xâ€™ should be powered.Â
• The parameter â€˜zâ€™: It is an optional input parameter. This parameter derives the modulus of the power value obtained when â€˜xâ€™ is raised to the power â€˜yâ€™.

## Read our popular Data Science Articles

 Data Science Career Path: A Comprehensive Career Guide Data Science Career Growth: The Future of Work is here Why is Data Science Important? 8 Ways Data Science Brings Value to the Business Relevance of Data Science for Managers The Ultimate Data Science Cheat Sheet Every Data Scientists Should Have Top 6 Reasons Why You Should Become a Data Scientist A Day in the Life of Data Scientist: What do they do? Myth Busted: Data Science doesnâ€™t need Coding Business Intelligence vs Data Science: What are the differences?

### Power Method in Python: Different cases of input parameters:

• The argument â€˜xâ€™ can be either a positive integer or a negative integer. It is mandatory for the programmer to assign a value to this parameter.
• The parameter â€˜yâ€™ also is a compulsory input parameter and accept the value that is either positive or negative integers.
• The parameter â€˜zâ€™ is optional. It may or may not be passed as per the userâ€™s requirement. If assigned a value, the parameter â€˜zâ€™ can take up any positive or negative integer.

### Return Value

Positive integer Positive integerÂ  Not assigned Integer
Positive integer Positive integer Not assigned Floating point number
Negative integer Positive integer Not assignedÂ  Integer
Negative integer Negative integer Not assigned Integer
Positive / negative integer Positive / negative integer Positive / negative integer Integer

You can learn both theoretical and practical aspects of Python with upGrad’s Professional Certificate in Data Science and Business Analytics from the University of Maryland. This course helps you learn Python from scratch. Even if you are new to programming and coding, upGrad will offer you a two-week preparatory course so that you can pick up on the basics of programming. you will learn about various tools like Python, SQL,, while working on multiple industry projects.