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
rodikova [14]
4 years ago
15

Write the following decorators and apply them to a single function (applying multiple decorators to a single function): 1. The f

irst decorator is called strong and has an inner function called wrapper. The purpose of this decorator is to add the html tags of and to the argument of the decorator. The return value of the wrapper should look like: return """" + func() + """" 2. The decorator will return the wrapper per usual. 3. The second decorat
Engineering
1 answer:
natita [175]4 years ago
5 0

Answer:

Complete question is:

write the following decorators and apply them to a single function (applying multiple decorators to a single function):

1. The first decorator is called strong and has an inner function called wrapper. The purpose of this decorator is to add the html tags of <strong> and </strong> to the argument of the decorator. The return value of the wrapper should look like: return “<strong>” + func() + “</strong>”

2. The decorator will return the wrapper per usual.

3. The second decorator is called emphasis and has an inner function called wrapper. The purpose of this decorator is to add the html tags of <em> and </em> to the argument of the decorator similar to step 1. The return value of the wrapper should look like: return “<em>” + func() + “</em>.

4. Use the greetings() function in problem 1 as the decorated function that simply prints “Hello”.

5. Apply both decorators (by @ operator to greetings()).

6. Invoke the greetings() function and capture the result.

Code :

def strong_decorator(func):

def func_wrapper(name):

return "<strong>{0}</strong>".format(func(name))

return func_wrapper

def em_decorator(func):

def func_wrapper(name):

return "<em>{0}</em>".format(func(name))

return func_wrapper

@strong_decorator

@em_decorator

def Greetings(name):

return "{0}".format(name)

print(Greetings("Hello"))

Explanation:

You might be interested in
In part A you are asked to write the pseudocode for the program. In part B you are asked to write the syntax of the code for the
Naya [18.7K]

Answer:

C++.

Explanation:

#include <iostream>

#include <string>

using namespace std;

///////////////////////////////////////////////////////////////

int main() {

   string quote, book;

   int page;

   

   cout<<"What is your favorite quote from a book?"<<endl;

   getline(cin, quote);

   cout<<endl;

   /////////////////////////////////////////////

   cout<<"What book was that quote from?"<<endl;

   getline(cin, book);

   cout<<endl;

   /////////////////////////////////////////////

   cout<<"What page was that quote from?"<<endl;

   cin>>page;

   cout<<endl;

   /////////////////////////////////////////////

   int no_of_upper_characters = 0;

   for (int i=0; i<quote.length(); i++) {

       if (isupper(quote[i]))

          no_of_upper_characters++;

   }

   

   cout<<"No. of upper case characters: "<<no_of_upper_characters<<endl;

   /////////////////////////////////////////////

   int no_of_characters = quote.length();

   cout<<"No. of characters: "<<no_of_characters<<endl;

   /////////////////////////////////////////////

   bool isDog = false;

   for (int i=0; i<quote.length(); i++) {

       if (isDog == true)

           break;

       else if (quote[i] == 'd') {

           for (int j=i+1; j<quote.length(); j++) {

               if (isDog == true)

                   break;

               else if (quote[j] == 'o') {

                   for (int z=j+1; z<quote.length(); z++) {

                       if (quote[z] == 'g') {

                           isDog = true;

                           break;

                       }

                   }

               }

           }

       }

   }

   

   if (isDog == true)

       cout<<"This includes 'd' 'o' 'g' in the quote";

   //////////////////////////////////////////////

   return 0;

}

3 0
3 years ago
A wooden pallet carrying 540kg rests on a wooden floor. (a) a forklift driver decides to push it without lifting it.what force m
kicyunya [14]

Answer:

The appropriate solution is "1481.76 N".

Explanation:

According to the question,

Mass,

m = 540 kg

Coefficient of static friction,

\mu_s = 0.28

Now,

The applied force will be:

⇒ F=\mu_s mg

By substituting the values, we get

       =0.28\times 540\times 9.8

       =1481.76 \ N

8 0
3 years ago
HOW TO CALCULATE MARGINAL RATE
Basile [38]

Answer:

Divide the difference in tax by the amount of income from the investment, and you'll get the economic marginal tax rate from investing. Most people refer to marginal tax rates as being identical to tax brackets.

hope this helps

have a good day :)

Explanation:

8 0
3 years ago
Damage reports should contain the information needed for what?
SIZIF [17.4K]

Answer:

<h2>it's damage kindly be careful</h2>
3 0
3 years ago
A constant-head permeability test gives the following information: - Water flows horizontally through the soil sample. - The hei
Marysya12 [62]

Answer:

Complete answer to the question is explained in the attached files.please have a look on it.

Explanation:

5 0
3 years ago
Other questions:
  • Which of the following are all desirable properties of a hydraulic fluid? a. good heat transfer capability, low viscosity, high
    5·1 answer
  • Write a static method named fixSpacing that accepts a Scanner representing a file as a parameter and writes that file's text to
    5·1 answer
  • A company that produces footballs uses a proprietary mixture of ideal gases to inflate their footballs. If the temperature of 23
    11·1 answer
  • A Carnot engine has a piston displacement volume of 7.5 liters. The volume at the beginning of heat addition is 1.0 liters, the
    14·1 answer
  • The European Space Agency launched a probe called Rosetta in March 2004. In August​ 2014, Rosetta reached its​ destination: a co
    13·1 answer
  • A steel plate has a hole drilled through it. The plate is put into a furnace and heated. What happens to the size of the inside
    9·1 answer
  • What are the prefixes for 1, 10, 1000, 1,000,000, .1, .01, .001, .000001
    9·1 answer
  • Electricians will sometimes call ______ "disconnects" or a "disconnecting means."
    15·1 answer
  • A proposed embankment fill requires 7100 ft of compacted soil. The void ratio of the compacted fill is specified as 0.5. Four bo
    10·1 answer
  • Is the science of measurement
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!