aboutsummaryrefslogtreecommitdiff
path: root/challenge-196/sgreen/python/ch-1.py
blob: 57b37a70da6e2b79cae92d8baa4db9406364276a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env python3

from itertools import combinations
import sys

def main(n):
    # Work through all combinations of positions
    for x in combinations(range(len(n)), 3):
        i, j, k = sorted(x)
        if n[i] < n[k] < n[j]:
            print(f'({n[i]}, {n[j]}, {n[k]})')
            return

    # No solution is found
    print('()')

if __name__ == '__main__':
    # Turn the strings into integers
    n = [int(i) for i in sys.argv[1:]]
    main(n)