Created
May 11, 2022 01:56
-
-
Save ricardodani/3e724df363071b6a05e94c54fc03b099 to your computer and use it in GitHub Desktop.
Python decorator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def print_result(func): | |
def decorated_func(a, b): | |
return f"o resultado é {func(a, b)}" | |
return decorated_func | |
@print_result | |
def soma(a, b): | |
return a + b | |
@print_result | |
def multiplica(a, b): | |
return a * b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment