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
What percentage is 122 out of 222?
den301095 [7]

Answer:

Divide the first number by the second.

Explanation:

~55%

4 0
3 years ago
Read 2 more answers
a circular pile, 19 m long is driven into a homogeneous sand layer. The piles width is 0.5 m. The standard penetration resistanc
Elena L [17]

Answer:

Point force (Qp) = 704 kn/m²

Explanation:

Given:

length = 19 m

Width = 0.5 m

fs = 4

Vicinity of the pile = 25

Find:

Point force (Qp)

Computation:

Point force (Qp) = fs²(l+v)

Point force (Qp) = 4²(25+19)

Point force (Qp) = 16(44)

Point force (Qp) = 704 kn/m²

5 0
3 years ago
What is a two stroke engine and what is a four stroke engine, please keep the definitions as simple as can be and please explain
rewona [7]

Answer:

A two-stroke engine is a type of internal combustion engine that completes a power cycle with two strokes of the piston during only one crankshaft revolution.

A four-stroke engine is an internal combustion engine in which the piston completes four separate strokes while turning the crankshaft. A stroke refers to the full travel of the piston along the cylinder, in either direction.

process for two stroke engine

This is in contrast to a "four-stroke engine", which requires four strokes of the piston to complete a power cycle during two crankshaft revolutions.In a two-stroke engine, the end of the combustion stroke and the beginning of the compression stroke happen simultaneously, with the intake and exhaust (or scavenging) functions occurring at the same time.Two-stroke engines often have a high power-to-weight ratio, power being available in a narrow range of rotational speeds called the "power band". Compared to four-stroke engines, two-stroke engines have a greatly reduced number of moving parts.

process for four stroke engine

A stroke refers to the full travel of the piston along the cylinder, in either direction. The four separate strokes are termed:

Intake: Also known as induction or suction. This stroke of the piston begins at top dead center (T.D.C.) and ends at bottom dead center (B.D.C.). In this stroke the intake valve must be in the open position while the piston pulls an air-fuel mixture into the cylinder by producing vacuum pressure into the cylinder through its downward motion. The piston is moving down as air is being sucked in by the downward motion against the piston.

Compression: This stroke begins at B.D.C, or just at the end of the suction stroke, and ends at T.D.C. In this stroke the piston compresses the air-fuel mixture in preparation for ignition during the power stroke (below). Both the intake and exhaust valves are closed during this stage.

Combustion: Also known as power or ignition. This is the start of the second revolution of the four stroke cycle. At this point the crankshaft has completed a full 360 degree revolution. While the piston is at T.D.C. (the end of the compression stroke) the compressed air-fuel mixture is ignited by a spark plug (in a gasoline engine) or by heat generated by high compression (diesel engines), forcefully returning the piston to B.D.C. This stroke produces mechanical work from the engine to turn the crankshaft.

Exhaust: Also known as outlet. During the exhaust stroke, the piston, once again, returns from B.D.C. to T.D.C. while the exhaust valve is open. This action expels the spent air-fuel mixture through the exhaust valve.

characteristics of two stroke and four stroke engines (which one gets hotter)

Since there are twice as many power strokes during the operation of a two-stroke engine as there are during the operation of a four-stroke engine, the engine tends to heat up more, and thus is likely to have a shorter life. Also, in the two-stroke engine lubricating oil must be mixed with the fuel.

6 0
3 years ago
Read 2 more answers
The two basic categories of electrical switches are manual and ??
Ganezh [65]

Answer:

are Manual and Automatic

4 0
3 years ago
Read 2 more answers
Calculate the "exact" alkalinity of the water in Problem 3-2 if the pH is 9.43.
marin [14]

Answer:

A) approximate alkalinity = 123.361 mg/l

B) exact alkalinity = 124.708 mg/l

Explanation:

Given data :

A) determine approximate alkalinity first

Bicarbonate ion = 120 mg/l

carbonate ion = 15 mg/l

Approximate alkalinity = ( carbonate ion ) * 50/30  + ( bicarbonate ion ) * 50/61

                                   = 15 * (50/30) + 120*( 50/61 )  = 123.361 mg/l  as CaCO3

B) calculate the exact alkalinity of the water if the pH = 9.43

pH + pOH = 14

9.43 + pOH = 14. therefore pOH = 14 - 9.43 = 4.57

[OH^- ] = 10^-4.57  = 2.692*10^-5  moles/l

[ OH^- ]   = 2.692*10^-5  * 179/mole * 10^3 mg/g  = 0.458 mg/l

[ H^+ ] = 10^-9.43 * 1 * 10^3  = 3.7154 * 10^-7 mg/l

therefore the exact alkalinity can be calculated as

= ( approximate alkalinity ) + ( [ OH^- ] * 50/17 ) - ( [ H^+ ] * 50/1 )

= 123.361 + ( 0.458 * 50/17 ) - ( 3.7154 * 10^-7 * 50/1 )

= 124.708 mg/l

8 0
3 years ago
Other questions:
  • What Type of diploma do you need in order To the get into JMU
    12·1 answer
  • What colour is best for radiative heat transfer? a. Black b. Brown c. Blue d. White
    7·1 answer
  • You have just finished your OST takeoffs for a single-story home and found 175 LF of interior walls with 2x6 studs 14" OC. The h
    14·1 answer
  • Engineering Questions
    15·2 answers
  • 63Ni decays by a first-order process via the emission of a beta particle. The 63Ni isotope has a half-life of 100. years. How lo
    13·1 answer
  • 2.(10 pts)A proposed engine cycle employs an ideal gas and consists of the following sequence of transformations; a) Isothermal
    12·1 answer
  • Describe a me <br><br> best answer gets brainliest
    9·2 answers
  • What is the common applications for gypsum in construction
    5·1 answer
  • While reflecting on the solutions and the process of concept generation, the development team takes a look at some critical ques
    10·1 answer
  • Metric wire size is measured in units of?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!