Greetings

Report a typo

We have a predefined function that takes a name and prints a greeting message with this name:

def greetings(name):
    print('Hello,', name)

Now, write a decorator @morning that will print another string, saying 'Good morning' after the greeting. Below you can see the result of the function with the decorator and the input name Susie:

# Hello, Susie
# Good morning, Susie

You do not need to take any input or call a function, just write the body of the decorator.

Tip: Remember that one of the ways to complete this task is to make the wrapper function, located inside your decorator, print the needed string, and make the decorator itself return the wrapper function.

Write a program in Python 3
def morning():
...
___

Create a free account to access the full topic