0

Help to find mistake pls

Its all about this lesson def decor(func): def wrap(): print("============") func() print("============") return wrap def print_text(): print("Hello world!") decorated = decor(print_text) decorated() the outputs are beautiful ============ Hello world! ============ While I tried to repeat my self with code def func_main(func1): def sub_func(): print("***********") print(func1) print("***********") return sub_func def print_smth(): print("Hello everybody!") decor = func_main(print_smth) decor() It runs with shitty: *********** <function print_smth at 0x1067981e0> *********** What am I doing wrong?

3rd Jul 2018, 10:16 AM
Arthur P
Arthur P - avatar
3 Réponses
+ 4
Instead of : print("**********"') print(func1) print("**********"') It should be: print("**********"') func1() print("**********"') Max Rubs It's printing those weird text coz you're printing the function instead of calling it. Here's a working code: https://code.sololearn.com/cdSRSbyiz9Nh/?ref=app
3rd Jul 2018, 10:39 AM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 3
And next time, please post the code link instead of copy pasting the whole code.👍 That way, we can easily debug it.
3rd Jul 2018, 10:43 AM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 1
Thank you, sir!
3rd Jul 2018, 11:05 AM
Arthur P
Arthur P - avatar