Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions html_decorators.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
def div(func):
# You have to code here!
pass

def wrapper(*args, **kwargs):
funci = func(*args, **kwargs)
print(f"<div>{funci}</div>")
return funci
return wrapper

def article(func):
# You have to code here!
pass

def wrapper(*args, **kwargs):
funci = func(*args, **kwargs)
print(f"<article>{funci}</article>")
return funci
return wrapper

def p(func):
# You have to code here!
pass
def wrapper(*args, **kwargs):
funci = func(*args, **kwargs)
print(f"<p>{funci}</p>")

return wrapper


# Here you must apply the decorators, uncomment this later
# @div
# @article
# @p
@p
@article
@div
def saludo(nombre):
return f'¡Hola {nombre}, ¿Cómo estás?'


def run():
print(saludo('Jorge'))
saludo('Jorge')


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion time_elapsed.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import datetime
from datetime import datetime


def execution_time(func):
Expand Down