Please can anyone explain these codes to me by each line by line. I didn't understand these codes after trying one day. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Please can anyone explain these codes to me by each line by line. I didn't understand these codes after trying one day.

https://code.sololearn.com/ca5PX8diBjF1/?ref=app https://code.sololearn.com/c5jdikRodr4m/?ref=app

11th May 2020, 7:49 AM
AHAMED KHALIFA Z
AHAMED KHALIFA Z - avatar
2 Answers
0
def decor(func): def wrap(): print("============") func() print("============") return wrap @decor def print_text(): print("Hello world!") print_text() -> When we call this method, the decorator method will execute first, In this case, decor method: you are passing the print text as a func. when we call the func() -> hello world because you are calling a function. We were wrapping this print text to decor I go through your code
11th May 2020, 8:01 AM
Dilji
Dilji - avatar
0
Why we return wrap and we unable to print the returned wrap and why wrap is used instead of wrap() in return. And what about the first code.
11th May 2020, 8:03 AM
AHAMED KHALIFA Z
AHAMED KHALIFA Z - avatar