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
OLEGan [10]
3 years ago
6

Implement a recursive method named power that takes 2 integer parameters named base and expo. The method will return the base ra

ised to the power of expo.
Computers and Technology
1 answer:
nika2105 [10]3 years ago
3 0

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 might be interested in
Write a class named Employee that holds the following data about an employee in attributes: name, ID number, department, and job
viktelen [127]

firstly we have to create class and then constructors and method

let start with class

class Employee:

   def __init__(self, name, id, department, title):

       self.__name = name

       self.__id = id

       self.__department = department

       self.__title = title

   def set_name(self, name):

       self.__name = name

   def set_id(self, id):

       self.__id = id

   def set_department(self, department):

       self.__department = department

   def set_title(self, title):

       self.__title = title

   def get_name(self):

       return self.__name

   def get_id(self):

return self.__id

   def get_department(self):

       return self.__department

   def get_title(self):

       return self.__title

def __str__(self):

       return 'Name: ' + self.__name + \

              '\nID number: ' + self.__id + \

              '\nDepartment: ' + self.__department + \

              '\nTitle: ' + self.__title

Now to test the program

import emp

def main():

   emp1 = emp.Employee('name', 'id', 'department', 'title')

   emp2 = emp.Employee('name', 'id', 'department', 'title')

   emp3 = emp.Employee('name', 'id', 'department', 'title')

 

   emp1.set_name('Susan Meyers')

   emp1.set_id('47899')

   emp1.set_department('Accounting')

   emp1.set_title('Vice President')

   emp2.set_name('Mark Jones')

   emp2.set_id('39119')

   emp2.set_department('IT')

   emp2.set_title('Programmer')

   emp3.set_name('Joy Rogersr')

   emp3.set_id('81774')

   emp3.set_department('Manufacturing')

   emp3.set_title('Engineer')

   print()

   print(emp1)

   print()

 print(emp2)

   print()

   print(emp3)

main()

4 0
3 years ago
Importance of word processing application​
alina1380 [7]

Answer:

Some of the functions of word processing software include: Creating, editing, saving and printing documents. Copying, pasting, moving and deleting text within a document. Formatting text, such as font type, bolding, underlining or italicizing.

Explanation:

8 0
4 years ago
Suppose that alpha, beta, and gamma are int variables and the input is: 100 110 120 200 210 220 300 310 320 What is the value of
barxatty [35]

Answer:

The answer to this question is the option "C".

Explanation:

In the question, it is given that alpha, beta, and gamma are an integer variable that assigns the value. In this code, we use the ignore() function. This function used to ignore or clear one or more characters from the input buffer. So the answer to this question is 300.

3 0
4 years ago
Jack has determined that a virus has infiltrated his computer and corrupted several of his data files. Which two utilities would
Romashka [77]
Antivirus programs to detect and eliminate viruses such as Malwarebytes, Stinger, etc.

A hard drive to backup all of his remaining files.

Corrupted files are not always possible to recover, but it's worth a try using a software such as Recuva.
7 0
3 years ago
Read 2 more answers
What is one task of a system optimization tool?
8_murik_8 [283]

Answer: Identifies what apps start on boot

Explanation: sys opt tools find things that are slowing down your device so anything within that lens will work cleaning sys storage could also work as an answer

6 0
4 years ago
Read 2 more answers
Other questions:
  • How do you represent a 3D object with unusual curves in 2D space? CAN SOMEONE HELP PLEASE
    12·1 answer
  • Write a function named printtriangle that receives a parameter that holds a non-negative integer value and prints a triangle of
    7·1 answer
  • Marilyn needs help exporting her spreadsheet as a few different types of files. She needs to know exactly how her file should be
    11·1 answer
  • 23
    15·1 answer
  • )duplicate hash code
    15·1 answer
  • If someone runs a red light in front of you and you choose not to slow down or steer away you will
    8·1 answer
  • The Painting Company has determined that for every 112 square feet of wall space:
    5·1 answer
  • How to type this [attachment] type of symbol in ms word.​
    14·2 answers
  • Question 1 Why should a user seek support when troubleshooting a computer problem is beyond his or her technical knowledge?​
    15·1 answer
  • If you’d like to have multiple italicized words in your document, how would you change the font of each of these words
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!