What is decorator in python
As a developer best way to write code within a function or class. but what if our code enter in function and return exception error. Decorator is function which validate the passing parameter in function. if parameter is valid then code enter in the function block otherwise code didn't enter into it.
first we use decorator_function and it goes to inner function validate, if number is greater then 0 the it return the function otherwise print message and it can't enter the factorial function.
how we use decorator in function:
now call this function and print the result print(factorial(5))