aboutsummaryrefslogtreecommitdiff
path: root/challenge-171/eric-cheung/python/ch-2.py
diff options
context:
space:
mode:
authordrbaggy <js5@sanger.ac.uk>2022-06-30 22:44:10 +0100
committerdrbaggy <js5@sanger.ac.uk>2022-06-30 22:44:10 +0100
commitf70fdfee84f602971a4c6c144635883960f2c54f (patch)
tree4884421464be2b25e10dfac958d9fafc39e1b319 /challenge-171/eric-cheung/python/ch-2.py
parent58f5e220ae958fe48453e45fedc079df6b466d54 (diff)
parent7755a024f5e0ed7581cce5bdaf7d1156e83fe076 (diff)
downloadperlweeklychallenge-club-f70fdfee84f602971a4c6c144635883960f2c54f.tar.gz
perlweeklychallenge-club-f70fdfee84f602971a4c6c144635883960f2c54f.tar.bz2
perlweeklychallenge-club-f70fdfee84f602971a4c6c144635883960f2c54f.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'challenge-171/eric-cheung/python/ch-2.py')
-rwxr-xr-xchallenge-171/eric-cheung/python/ch-2.py27
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))
+