Basic Programs


Python Program to Calculate Power of a Number


In this example, you will learn to compute the power of a number using exponentiation(**) operator.

example.py
base=10
exp=3
result=base**exp
print("Result : ",result)

Output

Result :  1000

The exponentiation(**) operator used to get the power of a number. Syntax as follows,

   x**y
  • x is the base
  • y is the power

we can, raise the power(y) of base(x) using exponentiation(**) operator.

Prev Next