+ 1
Some mistake, can not find
Dear friends, help me find the error, I look forward to your clean look. My code is below, thanks a lot! This is my code: #ваш код def decor(func): def wrap(): print('***') func() print('***') print('END OF PAGE') return wrap @decor def invoice(num): print("INVOICE #" + num) invoice(input());
5 Antworten
+ 2
Lyapunov Alexander , it can be done this way.
https://code.sololearn.com/cSPtkiY99Zik/?ref=app
+ 2
+ 1
TheWh¡teCat 🇧🇬 Thank you for your answer, it is working.
But in example below function parameters are empty. What is difference between example and right task's code.
Example code:
def decor(func):
def wrap():
print("============")
func()
print("============")
return wrap
@decor
def print_text():
print("Hello world!")
print_text();
+ 1
Lyapunov Alexander , read about decorators carefully. When you have parameters (when there's a part of the result which needs to be flexible), you call the decorator function with 1 argument (set by the input), and the inner functions also must have the parameter.
+ 1
SoloProg, TheWh¡teCat 🇧🇬
Thank you very much!