Home » Python » Python programs

Python program to find power of a number using exponential operator

Python exponential operator example: Here, we are going to learn how to find power of a number using exponential operator using exponential (**) operator in Python?
Submitted by IncludeHelp, on April 12, 2019

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

Example:

    Input:
    a = 10
    b = 3

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

    Output:
    1000

Finding power of integer values

# 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

Finding power of float values

# 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





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.



Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.