+ 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());

5th Jan 2022, 6:53 PM
Lyapunov Alexander
Lyapunov Alexander - avatar
5 odpowiedzi
5th Jan 2022, 7:22 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
5th Jan 2022, 7:32 PM
SoloProg
SoloProg - avatar
+ 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();
5th Jan 2022, 7:38 PM
Lyapunov Alexander
Lyapunov Alexander - avatar
+ 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.
5th Jan 2022, 8:05 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 1
SoloProg, TheWh¡teCat 🇧🇬 Thank you very much!
5th Jan 2022, 8:27 PM
Lyapunov Alexander
Lyapunov Alexander - avatar