How to raise a number to a power in Python

Raising a number to a power N multiplies the number by itself N times. For example, 2 raised to the power of 3 is equal to 2 × 2 × 2 = 8.

Solution for How to raise a number to a power in Python : You can use the power operator, **, to raise a number to a power Place the power operator, **, between two numbers to raise the former number to the latter.

In this example, 2.0 is a float. The power operator accepts any numeric data type, such as an int or a float.


how-to-raise-a-number-to-a-power-in-python