hey developer I am just exploring decorator so there I got some error missing 1 required positional argument. but when I driving code in calling function i am providing particular value first look my code.
def main(func):
def wrapper(*args, **kwargs):
r, pi = func()
return pi * r
return wrapper
@main
def area(r, pi=3.14):
return r, pi
#drive
print(area(r=10))
You are missing the
rargument value in line 3:r, pi = func(): Pass*args, **kwargsin the func.This will fix your issue
output:
31.400000000000002