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
A car generator turns at 400 rpm (revolutions per minute) when the engine is idling. It has a rectangular coil with 300 turns of
larisa86 [58]

Answer:

The field strength needed is 0.625 T

Explanation:

Given;

angular frequency, ω = 400 rpm = (2π /60) x (400) = 41.893 rad/s

area of the rectangular coil, A =  L x B = 0.0611 x 0.05 = 0.003055 m²

number of tuns of the coil, N = 300 turns

peak emf = 24 V

The peak emf is given by;

emf₀ = NABω

B = (emf₀ ) / (NA ω)

B = (24) / (300 x 0.003055 x 41.893)

B = 0.625 T

Therefore, the field strength needed is 0.625 T

4 0
3 years ago
A battery with an f.e.m. of 12 V and negligible internal resistance is connected to a resistor of 545 How much energy is dissipa
Alenkasestr [34]

Answer:

When are resistors in series? Resistors are in series whenever the flow of charge, called the current, must flow through devices sequentially. For example, if current flows through a person holding a screwdriver and into the Earth, then  

R

1

 in Figure 1(a) could be the resistance of the screwdriver’s shaft,  

R

2

 the resistance of its handle,  

R

3

 the person’s body resistance, and  

R

4

 the resistance of her shoes.

Figure 2 shows resistors in series connected to a voltage source. It seems reasonable that the total resistance is the sum of the individual resistances, considering that the current has to pass through each resistor in sequence. (This fact would be an advantage to a person wishing to avoid an electrical shock, who could reduce the current by wearing high-resistance rubber-soled shoes. It could be a disadvantage if one of the resistances were a faulty high-resistance cord to an appliance that would reduce the operating current.)

Two electrical circuits are compared. The first one has three resistors, R sub one, R sub two, and R sub three, connected in series with a voltage source V to form a closed circuit. The first circuit is equivalent to the second circuit, which has a single resistor R sub s connected to a voltage source V. Both circuits carry a current I, which starts from the positive end of the voltage source and moves in a clockwise direction around the circuit.

Figure 2. Three resistors connected in series to a battery (left) and the equivalent single or series resistance (right).

To verify that resistances in series do indeed add, let us consider the loss of electrical power, called a voltage drop, in each resistor in Figure 2.

According to Ohm’s law, the voltage drop,  

V

, across a resistor when a current flows through it is calculated using the equation  

V

=

I

R

, where  

I

 equals the current in amps (A) and  

R

 is the resistance in ohms  

(

Ω

)

. Another way to think of this is that  

V

 is the voltage necessary to make a current  

I

 flow through a resistance  

R

.

So the voltage drop across  

R

1

 is  

V

1

=

I

R

1

, that across  

R

2

 is  

V

2

=

I

R

2

, and that across  

R

3

 is  

V

3

=

I

R

3

. The sum of these voltages equals the voltage output of the source; that is,

V

=

V

1

+

V

2

+

V

3

.

 

This equation is based on the conservation of energy and conservation of charge. Electrical potential energy can be described by the equation  

P

E

=

q

V

, where  

q

 is the electric charge and  

V

 is the voltage. Thus the energy supplied by the source is  

q

V

, while that dissipated by the resistors is

q

V

1

+

q

V

2

+

q

V

3

.

Explanation:

8 0
3 years ago
If superheated water vapor at 30 MPa iscooled at ​constant pressure​, it will eventually become saturated vapor, and with suffic
nirvana33 [79]

Answer:

False.

Explanation:

False. The pressure is above pressure at critical point (22.064 MPa.), the limit where pressure can prevent boiling.

3 0
3 years ago
Which of the followong parts does not rotate during starter operation? A. Commutator segments B. Armature windings c. Field wind
photoshop1234 [79]

Answer: B

Explanation: unless newer models added wingding to code inside fused computer...wingdings on a window ...not a motor

8 0
3 years ago
A masonry facade consisting of 3,800 square feet is to be constructed for a building. The total cost per worker hour is estimate
lana66690 [7]

Answer:

Days: 6.9444 days

Production rate: 547.2035 ft²/s

Explanation:

the solution is attached in the Word file

Download docx
6 0
3 years ago
Other questions:
  • Now, suppose that you have a balanced stereo signal in which the left and right channels have the same voltage amplitude, 500 mV
    8·1 answer
  • Check the answer that best describes the relationship between f(x) and x. (For example if f(x) is Θ(x) check that as your answer
    12·1 answer
  • 21.13 The index of refraction of corundum (Al2O3) is anisotropic. Suppose that visible light is passing from one grain to anothe
    5·1 answer
  • For a copper-silver alloy of composition 25 wt% Ag-75 wt% Cu and at 775°C (1425°F) do the following:
    15·1 answer
  • Sadadasdasdasdasdadaaasd1
    14·1 answer
  • The following passage contains a fragment. Select the correct revision. Presley took the exuberance of gospel and added the freq
    7·1 answer
  • if when you put your shirt in your pants, your shirt is tucked, does that mean when your shirt is over your pants, your pants ar
    6·2 answers
  • What kinds of problems or projects would a mechanical engineer work on?
    11·1 answer
  • Who here likes to play project gotham racing?<br> will mark brainlyest
    8·2 answers
  • Why do some ladders have a white tip or reflective tape attached to the tip?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!