Created
June 19, 2022 20:57
-
-
Save Abdurahman-hassan/107787b6d78a4ab0b47b73282ea1fcdd to your computer and use it in GitHub Desktop.
simple uses of order functions , that we set a param in a function and then we use this param as a new function that takes the same param of the original function
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 add(n1, n2): | |
return n1 + n2 | |
def multiply(n1, n2): | |
return n1 * n2 | |
def calc(n1, n2, newFun): | |
return newFun(n1, n2) | |
print(calc(5, 4, multiply)) | |
print(calc(5, 4, add)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment