How to Use pow() Function in PythonPython Basics


The pow() function returns the result of x to the power of y.

Example

#!/usr/bin/python3
# -*- coding: UTF-8 -*-

x = pow(4, 3)
print("pow(4, 3):  ", x)

x = pow(2, 2)
print("pow(2, 2):  ", x)

Output:

pow(4, 3):   64
pow(2, 2):   4

Syntax

pow(x, y)

Parameters

Name Description
x An integer.
y An integer.

Return Value

It returns the value of x to the power of y.

© 2024 Cheerlearn.com, all rights reserved. Privacy Policy | Contact Us