aboutsummaryrefslogtreecommitdiff
path: root/challenge-276/ryan-thompson/python/ch-1.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-276/ryan-thompson/python/ch-1.py')
-rwxr-xr-xchallenge-276/ryan-thompson/python/ch-1.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/challenge-276/ryan-thompson/python/ch-1.py b/challenge-276/ryan-thompson/python/ch-1.py
new file mode 100755
index 0000000000..9a217285c1
--- /dev/null
+++ b/challenge-276/ryan-thompson/python/ch-1.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+#
+# ch-1.py - Complete Day
+#
+# 2024 Ryan Thompson <rjt@cpan.org>
+
+def complete_day(hours):
+ count = 0
+ for i, m in enumerate(hours):
+ for n in filter(lambda n: ((m + n) % 24 == 0), hours[i+1:]):
+ count += 1
+
+ return(count)
+
+# Examples
+print(complete_day([12, 12, 30, 24, 24])) # 2
+print(complete_day([72, 48, 24, 5])) # 3
+print(complete_day([12, 18, 24])) # 0
+print(complete_day([])) # 0