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:
Answer:
True
Explanation:
The CNC is the primary interface between the machine operator and the machine.
Answer:
Do you have anymore information about this?
Answer:
a) v = +/- 0.323 m/s
b) x = -0.080134 m
c) v = +/- 1.004 m/s
Explanation:
Given:
a = - (0.1 + sin(x/b))
b = 0.8
v = 1 m/s @ x = 0
Find:
(a) the velocity of the particle when x = -1 m
(b) the position where the velocity is maximum
(c) the maximum velocity.
Solution:
- We will compute the velocity by integrating a by dt.
a = v*dv / dx = - (0.1 + sin(x/0.8))
- Separate variables:
v*dv = - (0.1 + sin(x/0.8)) . dx
-Integrate from v = 1 m/s @ x = 0:
0.5(v^2) = - (0.1x - 0.8cos(x/0.8)) - 0.8 + 0.5
0.5v^2 = 0.8cos(x/0.8) - 0.1x - 0.3
- Evaluate @ x = -1
0.5v^2 = 0.8 cos(-1/0.8) + 0.1 -0.3
v = sqrt (0.104516)
v = +/- 0.323 m/s
- v = v_max when a = 0:
-0.1 = sin(x/0.8)
x = -0.8*0.1002
x = -0.080134 m
- Hence,
v^2 = 1.6 cos(-0.080134/0.8) -0.6 -0.2*-0.080134
v = sqrt (0.504)
v = +/- 1.004 m/s