diff options
Diffstat (limited to 'challenge-171/eric-cheung/python/ch-2.py')
| -rwxr-xr-x | challenge-171/eric-cheung/python/ch-2.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/challenge-171/eric-cheung/python/ch-2.py b/challenge-171/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..9d800fc25b --- /dev/null +++ b/challenge-171/eric-cheung/python/ch-2.py @@ -0,0 +1,27 @@ +
+## Remarks
+## https://www.geeksforgeeks.org/first-class-functions-python/
+## https://theweeklychallenge.org/blog/perl-weekly-challenge-171/
+
+
+## Python Program to illustrate Functions can be Passed as Arguments to Other Functions
+def getShout(strText):
+ return strText.upper()
+
+
+def getWhisper(strText):
+ return strText.lower()
+
+
+def getGreet(Func_1, Func_2):
+ ## f = Func_1
+ ## g = Func_2
+ ## getGreet = h = compose(f, g)
+ return Func_1(Func_2("Hi, I am created by a function passed as an argument."))
+
+
+## Driver Code
+if __name__ == '__main__':
+
+ print (getGreet(getShout, getWhisper))
+
|
