aboutsummaryrefslogtreecommitdiff
path: root/challenge-338/eric-cheung/python
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <mohammad.anwar@yahoo.com>2025-09-08 09:10:43 +0100
committerMohammad Sajid Anwar <mohammad.anwar@yahoo.com>2025-09-08 09:10:43 +0100
commit1d073851f64d0b9edfb3966c3bf788528e72bbf4 (patch)
treed2d283cd6298811b894f68ea03d155c43a788244 /challenge-338/eric-cheung/python
parentd3703790885c7629c2546e8fd1b71a2d52e593dc (diff)
downloadperlweeklychallenge-club-1d073851f64d0b9edfb3966c3bf788528e72bbf4.tar.gz
perlweeklychallenge-club-1d073851f64d0b9edfb3966c3bf788528e72bbf4.tar.bz2
perlweeklychallenge-club-1d073851f64d0b9edfb3966c3bf788528e72bbf4.zip
- Added solutions by Andrew Shitov.
- Added solutions by Mark Anderson. - Added solutions by W. Luis Mochan. - Added solutions by Eric Cheung. - Added solutions by Niels van Dijke.
Diffstat (limited to 'challenge-338/eric-cheung/python')
-rwxr-xr-xchallenge-338/eric-cheung/python/ch-1.py10
-rwxr-xr-xchallenge-338/eric-cheung/python/ch-2.py24
2 files changed, 34 insertions, 0 deletions
diff --git a/challenge-338/eric-cheung/python/ch-1.py b/challenge-338/eric-cheung/python/ch-1.py
new file mode 100755
index 0000000000..5e4a1ea8ea
--- /dev/null
+++ b/challenge-338/eric-cheung/python/ch-1.py
@@ -0,0 +1,10 @@
+
+## arrMatrix = [[4, 4, 4, 4], [10, 0, 0, 0], [2, 2, 2, 9]] ## Example 1
+## arrMatrix = [[1, 5], [7, 3], [3, 5]] ## Example 2
+## arrMatrix = [[1, 2, 3], [3, 2, 1]] ## Example 3
+## arrMatrix = [[2, 8, 7], [7, 1, 3], [1, 9, 5]] ## Example 4
+arrMatrix = [[10, 20, 30], [5, 5, 5], [0, 100, 0], [25, 25, 25]] ## Example 5
+
+nHighestRowSum = max([sum(arrRowLoop) for arrRowLoop in arrMatrix])
+
+print (nHighestRowSum)
diff --git a/challenge-338/eric-cheung/python/ch-2.py b/challenge-338/eric-cheung/python/ch-2.py
new file mode 100755
index 0000000000..f819139317
--- /dev/null
+++ b/challenge-338/eric-cheung/python/ch-2.py
@@ -0,0 +1,24 @@
+
+## Example 1
+## arrInput_01 = [4, 5, 7]
+## arrInput_02 = [9, 1, 3, 4]
+
+## Example 2
+## arrInput_01 = [2, 3, 5, 4]
+## arrInput_02 = [3, 2, 5, 5, 8, 7]
+
+## Example 3
+## arrInput_01 = [2, 1, 11, 3]
+## arrInput_02 = [2, 5, 10, 2]
+
+## Example 4
+## arrInput_01 = [1, 2, 3]
+## arrInput_02 = [3, 2, 1]
+
+## Example 5
+arrInput_01 = [1, 0, 2, 3]
+arrInput_02 = [5, 0]
+
+nMaxDiff = max(abs(nElem_01 - nElem_02) for nElem_01 in arrInput_01 for nElem_02 in arrInput_02)
+
+print (nMaxDiff)