diff options
| author | Mohammad Sajid Anwar <Mohammad.Anwar@yahoo.com> | 2023-05-28 23:02:39 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-28 23:02:39 +0100 |
| commit | aa5aabcfa28705a61e65982cd3b6997d95225fad (patch) | |
| tree | c5e88b00c797ce756e025ef0ffc55725628f6625 /challenge-218/sgreen/python/ch-1.py | |
| parent | 650518d898452f3393f6b8c1eabf2f4d29d20560 (diff) | |
| parent | db9ac88d1c4d0656947edb0da8fc635ea0732084 (diff) | |
| download | perlweeklychallenge-club-aa5aabcfa28705a61e65982cd3b6997d95225fad.tar.gz perlweeklychallenge-club-aa5aabcfa28705a61e65982cd3b6997d95225fad.tar.bz2 perlweeklychallenge-club-aa5aabcfa28705a61e65982cd3b6997d95225fad.zip | |
Merge pull request #8145 from simongreen-net/master
Simon's solution to challenge 218
Diffstat (limited to 'challenge-218/sgreen/python/ch-1.py')
| -rwxr-xr-x | challenge-218/sgreen/python/ch-1.py | 16 |
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) |
