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
Which of the following represent typical account fees?
Tresset [83]
The correct answer is ATM fee, Service fee, and Minimum balance fee - all of these fees represent typical account fees.
An ATM fee is the couple of dollars that you have to pay when you withdraw your money from an ATM. Minimum balance fee refers to the fee that is paid if you want to keep your bank account "alive." And service fee you pay for certain banking services. There is no fee for routing number.
3 0
3 years ago
Define Technology In Your Own Words.
natta225 [31]
Technology is many things and has been here before phones have. Technology is machines and mechanisms that have helped people complete things.
8 0
3 years ago
Which conditional tab would you use to add a quick style to a form or report? Arrange Design Format Page Setup
Vilka [71]

Answer:Format

Explanation:

5 0
3 years ago
The RAND() function in Excel returns a pseudo-random number between 0 and 1. If you enter this function into 1000 cells (i.e. en
Neko [114]

Answer:

To get this, filter the column with the condition "less than or equal 0.1" and check the number of returned rows at the bottom of the worksheet ( mine is 87 rows from 1000).

Explanation:

The RAND() function in Microsoft Excel is used to generate random numbers between zero and one. It can also be used to generate a range of numbers with decimal places by multiplying the stop number with the rand function  

4 0
3 years ago
You can print powerpoint presentation handouts with up to ____ slides per page.
Ierofanga [76]
You can print up to 9 slides per page.
3 0
4 years ago
Other questions:
  • Q3** Write a query to create a new price list for books written by the same author. Allow the user to enter only the first 4 let
    15·1 answer
  • Which term describes the distinct number of colors a graphic contains? (1 point)?
    10·1 answer
  • Write a small program that asks the user how many asterisks it should print out. The user responds with a number, then the progr
    8·1 answer
  • reading is important blank areas of life A in very few B in many C only in academic D only in career​
    10·1 answer
  • Which of the following sentences is correct?a. Arithmetic log unit is used to perform both integer and floating point computatio
    8·1 answer
  • Libby’s keyboard is not working properly, but she wants to select options and commands from the screen itself. Which peripheral
    14·1 answer
  • Cuando se introduce una fórmula en una celda primero que hay que introducir es
    13·1 answer
  • 2. Sherry bought the following articles
    7·1 answer
  • While using a web-based order form, an attacker enters an unusually large value in the Quantity field. The value he or she enter
    15·1 answer
  • i installed windows 11 all looks ok except my ebay and some other sites are all white with black text no highlights or color???
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!