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
The correct area in sq. Inches and sq. Feet is: Select one: a. 966.76 sq. Inches and 8.056 sq. Feet b. 96.676 sq. Inches and 8.0
kogti [31]

Answer:

c. 96.676 sq. Inches and 0.671 sq. Feet

Explanation:

From the list of the given option, we are told to chose the correct area in sq. inches that correspond to sq. Feet.

If we recall from the knowledge of our conversion  table that,

1 sq feet = 144 sq inches

Then, let's confirm if the option were true.

a.  966.76 sq. Inches and 8.056 sq. Feet

Assuming

if 1 sq feet = 8.056

in sq inches, we have ( 8.056 × 144 ) sq inches

= 1160.064 sq. inches

So, 1160.064 sq. inches is equal to 8.056 sq. Feet. Then option 1 is wrong

b. 96.676 sq. Inches and 8.056 sq. Feet

if 1 sq feet = 8.056

in sq inches, we have ( 8.056 × 144 ) sq inches

= 1160.064 sq. inches

So, 1160.064 sq. inches is equal to 8.056 sq. Feet. Then option 2 is wrong/

c. 96.676 sq. Inches and 0.671 sq. Feet

if 1 sq feet = 0.671

in sq inches, we have ( 0.671 × 144 ) sq inches

=  96.624 sq. Inches which is closely equal to 96.676 sq. Inches

Therefore, this is the correct answer as it proves that 96.676 sq. Inches = 0.671 sq. Feet

8 0
3 years ago
How is engine power expressed?
mars1129 [50]

Answer: Engine power is the power that an engine can put out. It can be expressed in power units, most commonly kilowatt, pferdestärke (metric horsepower), or horsepower.

Explanation: (I hope this helped!! ^^)

5 0
2 years ago
Read 2 more answers
Is it possible to have a heat engine with efficiency of 100%?
Alex17521 [72]

Answer:

No

Explanation:

Heat engines are used for converting the heat into mechanical energy which is used for doing mechanical work.

The efficiency of heat engine is the fraction of mechanical energy to the thermal energy. The efficiency can not be 100% as some of the energy always loss due to friction and motion of the body parts of the heat engine.

7 0
3 years ago
Hello, how are you? ​
Kisachek [45]

Answer:

Hello, I'm good. Thank you for asking

8 0
2 years ago
Read 2 more answers
Which of the following animals can be found in the locality​
erastovalidia [21]

Answer:

c frog

Explanation:

frog have chance that can lived in the locality or in public place like river,lake,farm and other place that they can be lived and hunt foods. In the picture bear, elephant and tiger are can't lived in the locality that have many population of people. little percent of changes that they can hunts foods or lived in the public/locatlity place.

7 0
3 years ago
Other questions:
  • For a short time a rocket travels up and to the left at a constant speed of v = 650 m/s along the parabolic path y=600−35x2m, wh
    9·1 answer
  • 7. Which power source is an important transition between
    7·1 answer
  • How do batteries and other types of power sources make physical computing systems more mobile?
    15·2 answers
  • Please answer question #2
    6·1 answer
  • When do design engineers start on the design improvement step?
    14·1 answer
  • Determine the design angle ϕ (0∘≤ϕ≤90 ∘) between struts AB and AC so that the 400 lb horizontal force has a component of 600 lb
    10·1 answer
  • What is the difference between a series circuit and a parallel circuit?
    11·2 answers
  • PLEASE HELP!! Its easy!!!
    5·2 answers
  • Is santa real or nah is santa real or nah
    7·2 answers
  • Technician A ay that acid rain doe the mot harm when it firt fall on a finih. Technician B ay that hard water potting i uually j
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!