Discovering the intensity of a number in Python: Here, we will figure out how to discover the intensity of a number utilizing loop in Python?
Here, we will compute the estimation of Nth intensity of a number without utilizing power work.
The thought is utilizing loop. We will increase a number (at first with esteem 1) by the number contribution
by the client (of which we need to discover the estimation of Nth power) for N times. For duplicating
it by N times, we have to run our loop N times. Since we know the occasions loop will execute, so we are utilizing for a loop.
Example:
Input:
base: 5, power: 4
Output:
625
Python program to get the power of a number using a loop:
num = int(input("Enter the number of which you have to find power: "))
pw = int(input("Enter the power: "))
kj = 1
for n in range(pw):
kj = kj*num
print(kj)
Output:
Enter the number of which you have to find power: 5
Enter the power: 4
625