forked from PlatziMaster/challenge-python-04
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhtml_decorators.py
More file actions
44 lines (26 loc) · 738 Bytes
/
html_decorators.py
File metadata and controls
44 lines (26 loc) · 738 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
def div(func):
def wrapper(*args):
return f'<div>{func(*args)}</div>'
return wrapper
def article(func):
def wrapper(*args):
return f'<article>{func(*args)}</article>'
return wrapper
def p(func):
def wrapper(*args):
return f'<p>{func(*args)}</p>'
return wrapper
# Here you must apply the decorators, uncomment this later
# @div
# @article
# @p
def saludo(nombre):
return f'¡Hola {nombre}, ¿Cómo estás?'
def run():
print(saludo('Jorge'))
if __name__ == '__main__':
run()
# We want to have three different outputs 👇🏼
# <div>¡Hola Jorge, ¿Cómo estás?'</div>
# <article>¡Hola Jorge, ¿Cómo estás?'</article>
# <p>¡Hola Jorge, ¿Cómo estás?'</p>