Python Exponentiation Operator takes two operands, one on the left and other on the right, and computes the power of left operand (base) raised to the right operand (exponent).
The symbol used for Python Exponentiation operator is
Following is the syntax of Exponentiation Operator in Python.
result = operand_1 ** operand_2
operand_2 are numbers and the result is the
operand_1 raised to the exponent of
Example 1: Exponentiation of Integers
In this example, we shall take two integers, find the power of the first integer raised to the exponent of another, and print the result.
a = 14 b = 5 result = a ** b print('Result :', result)
Result : 537824
Now, let us take negative exponent and find the result.
a = 14 b = -5 result = a ** b print('Result :', result)
Result : 1.8593443208187064e-06
Example 2: Exponentiation of Floating Point Numbers
We can compute the exponent for floating point numbers. In the following example, we initialize two floating point numbers, and find the exponent.
a = 3.14 b = 4.1 result = a ** b print('Result :', result)
Result : 108.99625018584567
In this tutorial of Python Examples, we learned what Python Exponentiation Operator is, how to use it to find the power of a base number raised to the exponent.