aboutsummaryrefslogtreecommitdiff
path: root/challenge-276/eric-cheung/python
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2024-07-02 13:19:01 +0100
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2024-07-02 13:19:01 +0100
commitd3cd6c8a7072e6f3566176284074c04501bfe8e3 (patch)
tree089f60956b2bc3b2fb34cf9423e546a19ae893e7 /challenge-276/eric-cheung/python
parent4f41284bb307dda2b2dab0c26bdefe6723c1755c (diff)
downloadperlweeklychallenge-club-d3cd6c8a7072e6f3566176284074c04501bfe8e3.tar.gz
perlweeklychallenge-club-d3cd6c8a7072e6f3566176284074c04501bfe8e3.tar.bz2
perlweeklychallenge-club-d3cd6c8a7072e6f3566176284074c04501bfe8e3.zip
- Added solutions by Eric Cheung.
- Added solutions by Ulrich Rieke. - Added solutions by Roger Bell_West. - Added solutions by Robbie Hatley. - Added solutions by Simon Green. - Added solutions by Thomas Kohler. - Added solutions by Steven Wilson. - Added solutions by Mark Anderson. - Added solutions by PokGoPun. - Added solutions by W. Luis Mochan. - Added solutions by David Ferrone. - Added solutions by Peter Campbell Smith. - Added solutions by E. Choroba. - Added solutions by Ryan Thompson. - Added solutions by Matthew Neleigh. - Added solutions by Dave Jacoby. - Added solutions by Feng Chang. - Added solutions by Joelle Maslak. - Added solutions by Niels van Dijke. - Added solutions by Mariano Ortega.
Diffstat (limited to 'challenge-276/eric-cheung/python')
-rwxr-xr-xchallenge-276/eric-cheung/python/ch-1.py12
-rwxr-xr-xchallenge-276/eric-cheung/python/ch-2.py9
2 files changed, 21 insertions, 0 deletions
diff --git a/challenge-276/eric-cheung/python/ch-1.py b/challenge-276/eric-cheung/python/ch-1.py
new file mode 100755
index 0000000000..abb3112347
--- /dev/null
+++ b/challenge-276/eric-cheung/python/ch-1.py
@@ -0,0 +1,12 @@
+
+from itertools import combinations
+
+## arrHours = [12, 12, 30, 24, 24] ## Example 1
+## arrHours = [72, 48, 24, 5] ## Example 2
+arrHours = [12, 18, 24] ## Example 3
+
+arrComb = combinations(arrHours, 2)
+
+arrOutput = [arrLoop for arrLoop in list(arrComb) if sum(arrLoop) % 24 == 0]
+
+print (len(arrOutput))
diff --git a/challenge-276/eric-cheung/python/ch-2.py b/challenge-276/eric-cheung/python/ch-2.py
new file mode 100755
index 0000000000..1f41b77181
--- /dev/null
+++ b/challenge-276/eric-cheung/python/ch-2.py
@@ -0,0 +1,9 @@
+
+## arrInt = [1, 2, 2, 4, 1, 5] ## Example 1
+arrInt = [1, 2, 3, 4, 5] ## Example 2
+
+arrFreq = [arrInt.count(nLoop) for nLoop in set(arrInt)]
+
+nMaxFreq = max(arrFreq)
+
+print (nMaxFreq * arrFreq.count(nMaxFreq))