2) The following implementation computes the y-th power of x, in
a recursive manner, with a print feature.
def power(x, y):
if y == 0:
return 1
else:
answer = x * power(x,
y-1)
print("The",y,"-th
power of",x,"is",answer)
return
answer
What is the second line of output after running the following
code?
power(3,4)
2) The following implementation computes the y-th power of x, in a recursive manner, with a print feature. def power(x,
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am