Python’s pow function returns the result of raising a number to a given power. Define a function expo that performs this task, and state its computational complexity using big-O notation. The first argument of this function is the number, and the second argument is the exponent (nonnegative numbers only). You may use either a loop or a recursive function in your implementation.

Answers

Answer 1

Answer:

The function is as follows:

def expo(num,n):

   prod= 1

   for i in range(n):

       prod*=num

       

   return prod

The big-O notation is: O(n)

Explanation:

This defines the function

def expo(num,n):

This initialzes the product to 1

   prod= 1

This iteration is perfomed n times

   for i in range(n):

The number is multiplied by itself n times

       prod*=num

       

This returns the calculated power

   return prod

To calculate the complexity.

The loop is repeated n times.

Each operation has a complexity O(1).

So, in for n number of operations; the complexity is: O(n * 1)

This gives: O(n)


Related Questions

If the pictures are not the same size when they are selected from a file,

PowerPoint will use AutoCorrect so they are the same size.
the picture will be overcorrected.
these pictures will remain the size as in the file.
the layout should be fit to the slide.

Answers

Answer:

The correct answer is C) the pictures will remain the size as in the file

Explanation:

Microsoft Office PowerPoint is a multi-media presentation tool. It supports, videos, pictures, and hyperlinks.

When a picture is inserted by selection from a file, PowerPoint does not automatically resize. The editor or user will need to manually adjust the size(s) of the picture(s) to fit the dimensions they require.

Cheers

 

a predecessor of a work processor is​

Answers

Answer: Printing of documents was initially accomplished using IBM Selectric typewriters modified for ASCII-character input. These were later replaced by application-specific daisy wheel printers, first developed by Diablo, which became a Xerox company, and later by Qume.

Explanation:

What are the individual presentation objects that are found in the PowerPoint program and used to display content to an audience?

files
slides
cells
charts

Answers

Answer:

The answer is slides

Explanation:

PYTHON:
Defining a Figure of Merit
Consider a string-matching figure of merit. That is, it tells you how close to a given string another string is. Each matching letter in the same spot is worth one point. Only letters need be considered.
For instance, if the secret string reads 'BLACKBEARD', then 'BEACKBEARD' is worth 9 points, 'WHITEBEARD' is worth 5 points, 'BEARDBLACK' is worth 4 points, and 'CALICOJACK' is worth 1 point.
Compose a function pirate which accepts a string of characters guess and returns the number of characters which match the secret string 'BLACKBEARD'. It should be case-insensitive; that is, you should convert input to upper-case letters. It should return zero for strings which are not ten characters in length.
Your submission should include a function pirate( guess ) which returns a float or int representing the number of matching characters. (You should provide the secret string 'BLACKBEARD' inside the function, not outside of it.)
strings should not have same lengths

Answers

Answer:

figure of merit is a quantity used to characterize the performance of a device, system or method, relative to its alternatives. In engineering, figures of merit are often defined for particular materials or devices in order to determine their relative utility for an application.

Following are the Python program to find the string-matching figure:

Python Program:

def pirate(g):#defining the method pirate that takes one variable in parameter

 if len(g)!= 10:#defining if block that check the parameter length value that is not equal to 10

   return 0   #using the return keyword that return a value that is 0

 else:#defining else block

   g= g.upper()#defining g variable that converts the parameter value into upper value

   secretString = "BLACKBEARD"#defining string variable secretString that holds string value

   c = 0#defining integer variable c that holds integer value

 for i in range(0, len(g)):#defining loop that counts and check value is in string variable

   if g[i] == secretString[i]:#defining if block that checks value in secretString variable

     c += 1; #defining c variable that increments its value

   return c;#using return keyword that return c value

print(pirate("BEACKBEARD"))#using print method that calls pirate method and prints its value

print(pirate("WHITEBEARD"))#using print method that calls pirate method and prints its value

print(pirate("BEARDBLACK"))#using print method that calls pirate method and prints its value

print(pirate("CALICOJACK"))#using print method that calls pirate method and prints its value

Output:

Please find the attached file.

Program Explanation:

Defining the method "pirate" that takes one variable "g" in parameter.Inside the method an if block that checks the parameter length value that is not equal to 10, and uses the return keyword that returns a value that is 0In the else block, define the "g" variable that converts the parameter value into the upper value, and use a string variable "secretString" that holds the string value. In the next step, define an integer variable "c" that holds an integer value, and define a loop that counts and checks the value in a string variable.Inside this, define if block that checks the value in the "secretString" variable, increments the "c" value, and returns the "c" value.Outside the method, a print method that calls the "pirate" method prints its value.

Find out more about the string-matching here:

brainly.com/question/16717135

Other Questions
A psychologist takes an SRS of 404040 people in their twenties and 606060 people in their fifties and surveys them about their anxieties. Suppose that 48\%48%48, percent of people in their twenties and 28\%28%28, percent of people in their fifties have anxiety about flying. The psychologist will then look at the difference (\text{20's}-\text{50's})(20s50s)left parenthesis, start text, 20, apostrophe, s, end text, minus, start text, 50, apostrophe, s, end text, right parenthesis between the proportions of people with anxiety about flying in each sample. What will be the shape of the sampling distribution of the difference in sample proportions, and why? Speaker 1: A state has the right to overrule an act passed by Congress. After all, thenational government is supposed to share power with the states.Speaker 2: I believe that you are wrong. The states do share power with the nationalgovernment, but the Constitution says the national government hassupremacy.These speakers are debating an issue that eventually became known as the -A Monroe DoctrineB Nullification CrisisC Missouri CompromiseD Three-Fifths Compromise x - 3/2 = 3. Please show your work. Will mark BRAINLIEST 7Select the correct location on the image.Objects A and B are brought close to each other. Object A will soon become positively charged. Identify the charge that must transfer for thissituation to occur.+AB Your uncle and aunt own a shop which is busy and successful. You sometimes help in the shop duringyour holidays. Your English teacher asks you to make a speech to your class about the shop and yourexperience of working there. What is the area of this shape? I need it ASAP. Solve it please!![tex] {z}^{3} - 8i = 0[/tex] Evelyn owns a small business selling used books. She knows that in the last week 86 customers paid cash, 30 customers used a debit card, and 28 customers used a credit card. If next week, she is expecting 1200 customers, about how many would you expect to pay with a credit card? Round your answer to the nearest whole number. Hola! He visto en muchos comentarios de Twitter "svd" cuando alguien dice "dale fav a este Tweet y siganse entre ustedes" y en los comentarios ponen "svd". Qu significa? Se deja caer una piedra en un pozo y al cabo de 10s se oye el choque contra el fondo si la velocidad de sonido es de 330 m/s. Cul es la profundidad del pozo? OMG PLS HELP WITH THIS IM PANICKING OMG I GOT A F IN MATH MY MOM JUST YELLED AT ME IM CRYING PLS HELP WITH THS- PLSS TELL ME plz help me with this one [tex]y = - 3 \\ y = 3x + 12[/tex] urgent please those who know In a 100-word paragraph, describe the tone of each poem. Include details from the poems to support your answer. the poems are places and chicago What is the approximate volume of the cone?Use 3.14 for .A 1206 cmB 2170 cmC 3260 cmD 6510 cm What are the characteristics of manganese? what is x ? 3/2x -1=5 Anna is 88 years old and under the court-appointed guardianship of her daughter. One day Anna receives a telephone call from a health insurance salesman and purchases a $400-a-month Medigap insurance policy. This contract is: Please Help.The local sandwich shop manager is slicing deli meat for lunch. He needs to slice the same amount of pepperoni as salami. He needs three times as many pounds of ham as he does pepperoni. He needs twice as much turkey as he needs ham. The manager slices 44 pounds of deli meat in total. Help pls and thank youuu