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

import sys


def main(ints):
    solution = -1

    # Loop through each position
    for idx in range(len(ints)):
        # The index mod 10 is the value at this position
        if idx % 10 == ints[idx]:
            # We have the best solution, so no need to continue looping
            solution = idx
            break

    print(solution)


if __name__ == '__main__':
    # Convert input into integers
    array = [int(n) for n in sys.argv[1:]]
    main(array)