Find Power of a Number using Exponential (**) Operator in Python

Power of a number: In this tutorial, we will learn how to find the power of a given number using exponential (**) operator in Python? By IncludeHelp Last updated : April 09, 2023

Power of a Number in Python

To find the power of a number in Python, we can use exponential operator (**), which is also known as a power operator. It works with two operands (one on each side), and returns the exponential calculation.

Example

Given two numbers a and b, we have to find a to the power b using exponential operator (**).

Input:
a = 10
b = 3

# calculating power using exponential oprator (**)
result = a**b
print(result)

Output:
1000

Power of a number using exponential (**) operator

Let's see, how to find the power of given numbers. Consider the below given two different programs using to calculate power of integer and float numbers.

Find Power of Integer Numbers in Python

# python program to find the power of a number

a = 10
b = 3

# calculating power using exponential oprator (**)
result = a**b

print (a, " to the power of ", b, " is = ", result)

Output

10  to the power of  3  is =  1000

Find Power of Float Numbers in Python

# python program to find the power of a number

a = 10.23
b = 3.2

# calculating power using exponential oprator (**)
result = a**b

print (a, " to the power of ", b, " is = ", result)

Output

10.23  to the power of  3.2  is =  1704.5197114724524

Python Basic Programs »

Related Programs

Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.