About 186,000 results
Open links in new tab
  1. Python program to find the power of a number using recursion

    May 2, 2023 · Given a number N and power P, the task is to find the power of a number ( i.e. NP ) using recursion. Examples: Input: N = 2 , P = 3 Output: 8 Input: N = 5 , P = 2 Output: 25 …

  2. Recursion in Python with exponents - Stack Overflow

    Mar 8, 2015 · Recursion is a way of programming a problem, in which a function calls itself one or more times in its body. Usually, it is returning the return value of this function call.

  3. python - Using recursion to raise a base to an exponent to an exponent ...

    Apr 24, 2015 · Here is a workable solution: def power (base, exponent): if base == 0: if exponent == 0: return 1.0 # 0 ^ 0 is undefined. Using 1. else: return 0 if exponent == 0: return 1 …

  4. python - Recursive Exponentiation - Stack Overflow

    Aug 16, 2015 · I'm trying to write a small program that calculate exponents recursively and I am a bit stuck. It is a homework assignment and we have been asked to have a base case, when …

  5. Python program to find power of a number - GeeksforGeeks

    Feb 21, 2025 · Explanation: pow () function in res = pow (N, X) computes 2^3 =8, raising N to the power X. This approach uses recursion to divide the exponent into halves and reduce the …

  6. Day 11 : Python Program to calculate the power and exponent using recursion

    Dec 4, 2024 · This code calculates the power of a number (base) raised to an exponent (exp) using recursion. Let's break it down step-by-step: base: The base number. exp: The exponent …

  7. Python Program to Calculate the Power using Recursion

    1. Take the base and exponential value from the user. 2. Pass the numbers as arguments to a recursive function to find the power of the number. 3. Give the base condition that if the …

  8. Get the power of a number using recursion in Python

    In this tutorial, we will code a very basic beginner’s problem – calculate the power of a number using recursion in Python. Power of a number also called exponent of a number, is given as …

  9. Calculating the Power of a Number Using Recursion in Python

    Aug 11, 2023 · Learn how to calculate the power of a number using recursive functions in Python. This comprehensive guide covers the recursion concept, edge cases, memoization …

  10. Python program to find the power of a number using recursion

    Apr 9, 2023 · Given the base x and the power y and we have to find the x to the power y using recursion in Python. By using recursion – We will be multiplying a number (initially with value …

  11. Some results have been removed
Refresh