In: Computer Science
THIS IS IN PYTHON 3.0
Let's call the first function power(a,b). Use the built-in power function a**b in python to write a second function called testing(c) that tests if the first function is working or not.
I already have the function power(a,b), which is as follows:
def power(a, b):
if (b == 0): return 1
elif (int(b % 2) == 0):
return (power(a, int(b / 2)) *
power(a, int(b / 2)))
else:
return (a * power(a, int(a / 2)) *
power(a, int(b / 2)))
Here is the answer for your question in Python Programming Language.
CODE :
|
"""Declaring a and b values as global.""" |
SCREENSHOTS :
Please see the screenshots of the code below for indentations of the code. As python is a Language of indentations kindly check the indentations before execution.

OUTPUT :

Any doubts regarding this can be explained with pleasure :)