aboutsummaryrefslogtreecommitdiff
path: root/challenge-218/sgreen/python/ch-1.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-218/sgreen/python/ch-1.py')
-rwxr-xr-xchallenge-218/sgreen/python/ch-1.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/challenge-218/sgreen/python/ch-1.py b/challenge-218/sgreen/python/ch-1.py
new file mode 100755
index 0000000000..7085e998f4
--- /dev/null
+++ b/challenge-218/sgreen/python/ch-1.py
@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+
+import sys
+
+
+def main(array):
+ array = sorted(array)
+ solution1 = array[-3] * array[-2] * array[-1]
+ solution2 = array[0] * array[1] * array[-1]
+ print(max(solution1, solution2))
+
+
+if __name__ == '__main__':
+ # Turn the strings into integers
+ n = [int(i) for i in sys.argv[1:]]
+ main(n)