aboutsummaryrefslogtreecommitdiff
path: root/challenge-171/laurent-rosenfeld/python/ch-2.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-171/laurent-rosenfeld/python/ch-2.py')
-rw-r--r--challenge-171/laurent-rosenfeld/python/ch-2.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/challenge-171/laurent-rosenfeld/python/ch-2.py b/challenge-171/laurent-rosenfeld/python/ch-2.py
new file mode 100644
index 0000000000..01cb4943d5
--- /dev/null
+++ b/challenge-171/laurent-rosenfeld/python/ch-2.py
@@ -0,0 +1,11 @@
+def compose(f1, f2):
+ return lambda x: f1(f2(x))
+def f(p):
+ return p / 2 + 1
+def g(p):
+ return p * 2
+
+h = compose(f, g)
+
+for i in range(1, 6):
+ print (f(g(i)), " ", h(i))