Owls

Report a typo

Here we have the decorator nighttime and the function get_message that we pass to it. However, right now, the code is not going to work as there is something wrong with it.

def nighttime(func):
    def wrapper():
        print('It is nighttime')
        return func()

    return wrapper


@nighttime
def get_message(name):
    print('We can hear some night birds like', name)


get_message('owls')

What should we do to make it work properly and get the following message output?

# It is nighttime
# We can hear some night birds like owls
Select one option from the list
___

Create a free account to access the full topic