Account
Categories

Exponent AND Assign Operator


Definition:

The Exponent AND Assign Operator (**=) is used to raise a variable to the power of a value and store the result in the same variable.

It takes the value on the left side, raises it to the power of the value on the right side, and saves the result in the same variable.

Syntax:

variable **= value

Example:

x = 2
x **= 3  # raises x to the power 3
print(x)

Output: