aboutsummaryrefslogtreecommitdiff
path: root/challenge-250/sgreen/python/ch-1.py
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <Mohammad.Anwar@yahoo.com>2024-01-07 14:11:44 +0000
committerGitHub <noreply@github.com>2024-01-07 14:11:44 +0000
commita6368e3cd07bf057fda6f0d2ccfefcd4e32f8dcf (patch)
treeadf4b0d46e36320eb441d089ef9bcee7d3509961 /challenge-250/sgreen/python/ch-1.py
parentddc19ed5a251eb1b6123591a8594b4779eff7d38 (diff)
parent7b07d041a8c01b78ca1d311502b5e93b5d0a5153 (diff)
downloadperlweeklychallenge-club-a6368e3cd07bf057fda6f0d2ccfefcd4e32f8dcf.tar.gz
perlweeklychallenge-club-a6368e3cd07bf057fda6f0d2ccfefcd4e32f8dcf.tar.bz2
perlweeklychallenge-club-a6368e3cd07bf057fda6f0d2ccfefcd4e32f8dcf.zip
Merge pull request #9355 from simongreen-net/master
Simon's solution to challenge 250
Diffstat (limited to 'challenge-250/sgreen/python/ch-1.py')
-rwxr-xr-xchallenge-250/sgreen/python/ch-1.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/challenge-250/sgreen/python/ch-1.py b/challenge-250/sgreen/python/ch-1.py
new file mode 100755
index 0000000000..d907d03257
--- /dev/null
+++ b/challenge-250/sgreen/python/ch-1.py
@@ -0,0 +1,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)