Question: 1. In a Python file L9q1.py, write a recursive method, power, to computex by using the following recursive formula: x = 1 x =
1. In a Python file L9q1.py, write a recursive method, power, to computex" by using the following recursive formula: x = 1 x = (x/2) if n > 0 and his even x = x(x/2) if n > 0 and n is odd Write a driver program which will prompt the user to input a real number and an integer n and uses your power method to compute xn. If n is negative, note that x = 1/x", and use that to compute the result correctly. Print the result with an appropriate message. Sample Output 1: 1. Enter a number: 3 2. Enter an integer number between -100 and 100: 8 3.3.0 raised to the power of 8 is 6561.0 Sample Output 2: 1. Enter a number: 3 2. Enter an integer number between - 100 and 100: -4 3.3.0 raised to the power of -4 is 0.012345679012345678 Activa Go to S
Step by Step Solution
3.45 Rating (148 Votes )
There are 3 Steps involved in it
Heres the Python code for the recursive power method and the driver program python def powerx n Comp... View full answer
Get step-by-step solutions from verified subject matter experts
