aboutsummaryrefslogtreecommitdiff
path: root/challenge-240/sgreen/python
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-240/sgreen/python')
-rwxr-xr-xchallenge-240/sgreen/python/ch-1.py15
-rwxr-xr-xchallenge-240/sgreen/python/ch-2.py13
2 files changed, 28 insertions, 0 deletions
diff --git a/challenge-240/sgreen/python/ch-1.py b/challenge-240/sgreen/python/ch-1.py
new file mode 100755
index 0000000000..7f4a6e8caa
--- /dev/null
+++ b/challenge-240/sgreen/python/ch-1.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python3
+
+import sys
+
+
+def main(words, acronym):
+ # Calculate the first letters from the words
+ first_letters = ''.join(map(lambda w: w[0], words))
+ print('true' if first_letters.lower() == acronym.lower() else 'false')
+
+
+if __name__ == '__main__':
+ # The last value is the 'acronym'
+ acronym = sys.argv.pop()
+ main(sys.argv[1:], acronym)
diff --git a/challenge-240/sgreen/python/ch-2.py b/challenge-240/sgreen/python/ch-2.py
new file mode 100755
index 0000000000..fcd7d98d06
--- /dev/null
+++ b/challenge-240/sgreen/python/ch-2.py
@@ -0,0 +1,13 @@
+#!/usr/bin/env python3
+
+import sys
+
+
+def main(ints):
+ solution = [ ints[ints[i]] for i in range(len(ints))]
+ print(*solution, sep=', ')
+
+if __name__ == '__main__':
+ # Convert input into integers
+ array = [int(n) for n in sys.argv[1:]]
+ main(array)