Question: Using recursion and theis_divisiblefunction.Your program may assume that both arguments tois_powerare positive integers. Note that the only positive integer that is a power of 1
Using recursionand theis_divisiblefunction.Your program may assume that both arguments tois_powerare positive integers. Note that the only positive integer that is a power of "1" is "1" itself.
After writing youris_powerfunction, include the following test cases in your script to exercise the function and print the results:
print("is_power(10, 2) returns: ", is_power(10, 2))
print("is_power(27, 3) returns: ", is_power(27, 3))
print("is_power(1, 1) returns: ", is_power(1, 1))
print("is_power(10, 1) returns: ", is_power(10, 1))
print("is_power(3, 3) returns: ", is_power(3, 3))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
