1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Marrrta [24]
3 years ago
10

17.8.1: Writing a recursive math function. Write code to complete raise_to_power(). Note: This example is for practicing recursi

on; a non-recursive function, or using the built-in function math.pow(), would be more common.
Computers and Technology
1 answer:
Yuliya22 [10]3 years ago
6 0

Answer:

The recursion function is as follows:

def raise_to_power(num, power):

if power == 0:

 return 1

elif power == 1:

 return num

else:

 return (num*raise_to_power(num, power-1))

Explanation:

This defines the function

def raise_to_power(num, power):

If power is 0, this returns 1

if power == 0:

 return 1

If power is 1, this returns num

elif power == 1:

 return num

If otherwise, it calculates the power recursively

else:

 return (num*raise_to_power(num, power-1))

You might be interested in
A photograph is taken by letting light fall on a light-sensitive medium, which then records the image onto that medium.
Andru [333]
True. At least that's how it is for camera's that print photos. Not digital cameras
4 0
3 years ago
Read 2 more answers
The tcp/ip ____ layer commonly uses the transmission control protocol (tcp) to maintain an error-free end-to-end connection.
aleksklad [387]
The answer would be the TCP/IP Application Layer.
6 0
3 years ago
How is your day going?Technology affects the learning experience of students by helping them
Alex_Xolod [135]

Answer:

is this technology or

Explanation:

computer

5 0
3 years ago
Read 2 more answers
What is fair use?
koban [17]

Answer:

I believe its C

Explanation:

I'm sorry if its wrong...

8 0
3 years ago
Read 2 more answers
Your computer uses 4 bits to represent decimal numbers (0, 1, 2, 3 and so on) in binary. What is the SMALLEST number for which a
myrzilka [38]

Answer: C

Explanation:

I believe this is because you cannot represent the number sixteen with only four binary bits. The highest you can go is 15.

3 0
3 years ago
Other questions:
  • Create a new Die object. (Refer to Die.html for documentation.)Create a loop that will iterate at least 100 times. In the loop b
    11·1 answer
  • Which of the following programs can open a bitmap file?
    11·2 answers
  • What kind of heat we feel from the sun
    15·2 answers
  • Using C#, declare two variables of type string and assign them a value "The "use" of quotations causes difficulties." (without t
    11·1 answer
  • What is an identifier? Give an example of an identifier.
    13·1 answer
  • The IT department sent out a memo stating that it will start delivering desktop computer interfaces through the IT data center v
    5·1 answer
  • Help!! Best answer will get Brainliest!!
    10·2 answers
  • One way to use contiguous allocation of the disk and not suffer from holes is to compact the disk every time a file is removed.
    13·1 answer
  • What is the difference between second generation and third generation of computer​
    6·1 answer
  • Why does the position of drawCircle(x, y, r) in the answer choices matter?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!