A person responsible for running a business, organization, etc.
Answer:
def power(base, expo):
if expo == 0:
return 1
else:
return base * power(base, expo-1)
Explanation:
*The code is in Python.
Create a method called power that takes base and expo as parameters
Check if the expo is equal to 0. If it is return 1 (This is our base case for the method, where it stops. This way our method will call itself "expo" times). If expo is not 0, return base * power(base, expo-1). (Call the method itself, decrease the expo by 1 in each call and multiply the base)
You are able to mark your answers on tests and save your work, while on paper, you get it taken away from you.
Answer:
This is an infinite loop.
Explanation:
The while loop while never end since the last statement inside the while loop will continue to decrement the value of num by 1 and the condition num < 9 will always be true.
So either change the condition of the while loop like: num > -9
or start incrementing the variable num in the last statement of the while loop like:
num = num + 1
Note: Don't make both changes at the same time.
Visit: gotit-pro.com for fastest, top-notch and impeccable homework and exams help in a range of subjects and ace your academics.
Thanks and Best Regards: Your Friendly Study Co-Pilot