Please what is wrong with my Decorator code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please what is wrong with my Decorator code?

def decor(func): def w(): print("***") func() print("***") print ("END OF PAGE") return w @decor def invoice(num): print("INVOICE #" +num) invoice(input())

28th Jun 2021, 5:39 PM
Francis Omane Asirifi
Francis Omane Asirifi - avatar
1 Answer
+ 1
Well the func that you are passing into decor function and then calling needs to be called with argument as that is what it expects. argument can be passed to def w() and from there pass it on to func() def w(arg) print() func(arg) print()
28th Jun 2021, 5:59 PM
Abhay
Abhay - avatar