aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchirvasitua <stuart-little@users.noreply.github.com>2021-05-10 17:30:53 -0400
committerchirvasitua <stuart-little@users.noreply.github.com>2021-05-10 17:30:53 -0400
commit71e331c34ccc1b47e5e73a02af5abee5d3a3c58a (patch)
treef5340f72945728df0084199d45bc1423b702dfc2
parent765d55c53dabebcd6b5832e3396e6d4fdcbb56e1 (diff)
downloadperlweeklychallenge-club-71e331c34ccc1b47e5e73a02af5abee5d3a3c58a.tar.gz
perlweeklychallenge-club-71e331c34ccc1b47e5e73a02af5abee5d3a3c58a.tar.bz2
perlweeklychallenge-club-71e331c34ccc1b47e5e73a02af5abee5d3a3c58a.zip
1st commit on 112_python
-rwxr-xr-xchallenge-112/stuart-little/python/ch-1.py8
-rwxr-xr-xchallenge-112/stuart-little/python/ch-2.py21
2 files changed, 29 insertions, 0 deletions
diff --git a/challenge-112/stuart-little/python/ch-1.py b/challenge-112/stuart-little/python/ch-1.py
new file mode 100755
index 0000000000..64f5a02c1d
--- /dev/null
+++ b/challenge-112/stuart-little/python/ch-1.py
@@ -0,0 +1,8 @@
+#!/usr/bin/env python
+
+# run <script> <path>
+
+import os
+import sys
+
+print(os.path.normpath(sys.argv[1]))
diff --git a/challenge-112/stuart-little/python/ch-2.py b/challenge-112/stuart-little/python/ch-2.py
new file mode 100755
index 0000000000..041baec0a0
--- /dev/null
+++ b/challenge-112/stuart-little/python/ch-2.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+
+# run <script> <number>
+
+import sys
+
+memo = [
+ [[1,],],
+ [[1,1],[2,]],
+]
+
+def memoSteps(n):
+ if (n > len(memo)-1):
+ memo.append([*(map(lambda a: [1,*a], memoSteps(n-1))),*(map(lambda a: [2,*a], memoSteps(n-2)))])
+ return memo[n]
+
+res = memoSteps(int(sys.argv[1])-1)
+print(f"""{len(res)}
+{'-' * 12}""")
+for ar in res:
+ print(ar)