aboutsummaryrefslogtreecommitdiff
path: root/challenge-194/sgreen/python/ch-1.py
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2022-12-11 12:55:27 +0000
committerGitHub <noreply@github.com>2022-12-11 12:55:27 +0000
commit4c2e27fe17647d18d59c995e78ba8f6ab41090e6 (patch)
tree722091feea6910048dde6db8a15425453a461b5c /challenge-194/sgreen/python/ch-1.py
parenta63bb8a438e2e2ce209788585f802eaa0b344128 (diff)
parentcd0c1c2f37f184497d8dc4990d2ab50bf04a4052 (diff)
downloadperlweeklychallenge-club-4c2e27fe17647d18d59c995e78ba8f6ab41090e6.tar.gz
perlweeklychallenge-club-4c2e27fe17647d18d59c995e78ba8f6ab41090e6.tar.bz2
perlweeklychallenge-club-4c2e27fe17647d18d59c995e78ba8f6ab41090e6.zip
Merge pull request #7234 from simongreen-net/master
Simon's solution to challenge 194
Diffstat (limited to 'challenge-194/sgreen/python/ch-1.py')
-rwxr-xr-xchallenge-194/sgreen/python/ch-1.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/challenge-194/sgreen/python/ch-1.py b/challenge-194/sgreen/python/ch-1.py
new file mode 100755
index 0000000000..add4e38257
--- /dev/null
+++ b/challenge-194/sgreen/python/ch-1.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python3
+
+import sys
+
+def main(time):
+ value = None
+ if time[0] == '?':
+ # 2 if the second hour value is <= 3 else 1
+ value = 2 if int(time[1]) <= 3 else 1
+ elif time[1] == '?':
+ # 3 if the first hour value is 2 else 9
+ value = 3 if time[0] == '2' else 9
+ elif time[3] == '?':
+ # The maximum first minute value is always 5
+ value = 5
+ else:
+ # The maximum second minute value is always 9
+ value = 9
+
+ print(value)
+
+if __name__ == '__main__':
+ main(sys.argv[1]) \ No newline at end of file