0
decorator is printing none at the end?
#please tell me why none is getting printed at the end of the program? def decor(func): def wrap(): print("first line") func() print("second line") return wrap def print_text(): print("Hello world!") decorated = decor(print_text) print (decorated())
2 ответов
+ 4
Maybe make this the last line:
decorated()
You are already printing everything in the functions. The last line doesn't need a print statement.
0
You are not returning anything from the function print_text, that is the reason behind None.
Solution should be you can return from the print_text function or remove the print from this line print (decorated()).