diff --git a/hello_decorator.py b/hello_decorator.py new file mode 100644 index 0000000..0c792e5 --- /dev/null +++ b/hello_decorator.py @@ -0,0 +1,11 @@ +def decorator(func): + def wrapper(): + print("Something is happening before the function is called.") + func() + print("Something is happening after the function is called.") + return wrapper + +def say_whee(): + print("Whee!") + +say_whee = decorator(say_whee) diff --git a/inner_functions.py b/inner_functions.py index dc75814..b9a5399 100644 --- a/inner_functions.py +++ b/inner_functions.py @@ -1,11 +1,11 @@ -def parent(): - print("Printing from parent()") - +def parent(num): def first_child(): - print("Printing from first_child()") + return "Hi, I'm Elias" def second_child(): - print("Printing from second_child()") + return "Call me Ester" - second_child() - first_child() + if num == 1: + return first_child + else: + return second_child