Take two numbers from the users. Calculate the result of second number power of the first number.
To power, you will need to use two asterisks symbols (two multiplication symbols). For example 4 to the power 3 will be
result = 4**3
base_num = int(input('Give me the base number: '))
power_num = int(input('Give me the power number: '))
result = base_num ** power_num
print('Your result is: ', result)
Python has a built-in function named pow
. The pow is a short form of the word power. And you can pass 2 numbers to the pow function. It will give you the second number as a power of the first number.
Python has a built-in function named pow. The pow is a short form of the word power. And you can pass 2 numbers to the pow function. It will give you the second number as a power of the first number.
base_num = int(input('Give me the base number: '))
power_num = int(input('Give me the power number: '))
result = pow(base_num, power_num)
print('Your result is: ', result)
tags: programming-hero
python
python3
problem-solving
programming
coding-challenge
interview
learn-python
python-tutorial
programming-exercises
programming-challenges
programming-fundamentals
programming-contest
python-coding-challenges
python-problem-solving