aboutsummaryrefslogtreecommitdiff
path: root/challenge-194/sgreen/python/ch-1.py
diff options
context:
space:
mode:
authorSimon Green <mail@simon.green>2022-12-11 15:18:07 +1100
committerSimon Green <mail@simon.green>2022-12-11 15:18:07 +1100
commitcd0c1c2f37f184497d8dc4990d2ab50bf04a4052 (patch)
tree73b836480e9378cd12e49ae7e5e5bf4b3da7f971 /challenge-194/sgreen/python/ch-1.py
parent8d4ad39acceae6916068d7661648e075877837cc (diff)
downloadperlweeklychallenge-club-cd0c1c2f37f184497d8dc4990d2ab50bf04a4052.tar.gz
perlweeklychallenge-club-cd0c1c2f37f184497d8dc4990d2ab50bf04a4052.tar.bz2
perlweeklychallenge-club-cd0c1c2f37f184497d8dc4990d2ab50bf04a4052.zip
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