subject

In Python 3, write a decorator function that has the following property:

1. The name of the decorator is uppercase and takes a function as input.
2. The decorator has an inner function called wrapper with no input argument.
3. The wrapper function has two local variables: original and modified.
4. The input function argument of decorator gets assigned to the original variable inside the wrapper function and the upper case version of the input function gets assigned to the modified variable.
5. The wrapper function returns the modified variable.
6. The decorator returns the wrapper (per the usual of the inner functions in decorators)
7. Write a new function called greetings that prints "Hello".
8. Decorate the greetings function with the uppercase decorator function.
9. Run the program by invoking the greetings function. Record the output and include it with your code.
10. Save the decorator uppercase as a separate Python file and import it to a new file that defines the greetings function as a decorated function that simply prints the "Hello" message.
11. Generate the output by invoking the greetings function.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 02:30
The cm is responsible for overseeing the actions of the crisis management team and coordinating all crisis management efforts in cooperation with disaster recovery and/or business continuity planning, on an as-needed basis
Answers: 1
question
Computers and Technology, 23.06.2019 15:30
Hey so i was just trying out some game hacks so i took a paste from online and built it in my visual studio and then suddenly my computer was working or clicking on stuff on its own am i hacked?
Answers: 1
question
Computers and Technology, 23.06.2019 16:00
Helen is having a meeting with her colleagues in her company. they are working on the goals and objectives for the coming year. they want to ensure that these goals and objectives of the processes involved are properly evaluated. which system can helen and her colleagues apply to evaluate this? helen and her colleagues require a blank to evaluate the goals and objectives.
Answers: 2
question
Computers and Technology, 23.06.2019 21:20
In microsoft word, when you highlight existing text you want to replace, you're in              a.  advanced mode.    b.  automatic mode.    c.  basic mode.    d.  typeover mode
Answers: 1
You know the right answer?
In Python 3, write a decorator function that has the following property:

1. The name of...
Questions
question
Mathematics, 17.10.2020 08:01
question
Mathematics, 17.10.2020 08:01
question
Mathematics, 17.10.2020 08:01
Questions on the website: 13722361