What is the output of the following code ? def smart_divide(func): def wrapper(*args): a, b = args if b == 0: print(‘oops! cannot divide’) return return func(*args) return wrapper @smart_divide def divide(a, b): return a / b print(divide.name) print(divide(4, 16)) print(divide(8,0))

QuestionsCategory: Python 3What is the output of the following code ? def smart_divide(func): def wrapper(*args): a, b = args if b == 0: print(‘oops! cannot divide’) return return func(*args) return wrapper @smart_divide def divide(a, b): return a / b print(divide.name) print(divide(4, 16)) print(divide(8,0))
admin Staff asked 3 years ago

Answer: wrapper
0.25
oops! cannot divide
None