From 2b586bbcfa9f30c6f6548aaadddd665b2d80198f Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Tue, 11 Jul 2023 09:52:16 +0100 Subject: - Added solutions by Robert DiCicco. - Added solutions by Laurent Rosenfeld. - Added solutions by Ulrich Rieke. - Added solutions by Jaldhar H. Vyas. - Added solutions by W. Luis Mochan. - Added solutions by Robbie Hatley. - Added solutions by Mark Anderson. - Added solutions by David Ferrone. - Added solutions by Andreas Voegele. - Added solutions by Lubos Kolouch. - Added solutions by Thomas Kohler. --- challenge-225/eric-cheung/python/ch-1.py | 8 ++++++++ challenge-225/eric-cheung/python/ch-2.py | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100755 challenge-225/eric-cheung/python/ch-1.py create mode 100755 challenge-225/eric-cheung/python/ch-2.py (limited to 'challenge-225/eric-cheung/python') diff --git a/challenge-225/eric-cheung/python/ch-1.py b/challenge-225/eric-cheung/python/ch-1.py new file mode 100755 index 0000000000..f0095f08e1 --- /dev/null +++ b/challenge-225/eric-cheung/python/ch-1.py @@ -0,0 +1,8 @@ + +## arrWordList = ["Perl and Raku belong to the same family.", "I love Perl.", "The Perl and Raku Conference."] ## Example 1 +arrWordList = ["The Weekly Challenge.", "Python is the most popular guest language.", "Team PWC has over 300 members."] ## Example 2 + +arrWordLen = [len(wordLoop.split()) for wordLoop in arrWordList] +nMaxWordLen = max(arrWordLen) + +print (nMaxWordLen) diff --git a/challenge-225/eric-cheung/python/ch-2.py b/challenge-225/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..64e98389f4 --- /dev/null +++ b/challenge-225/eric-cheung/python/ch-2.py @@ -0,0 +1,19 @@ + +## arrInt = [10, 4, 8, 3] ## Example 1 +## arrInt = [1] ## Example 2 +arrInt = [1, 2, 3, 4, 5] ## Example 3 + +arrLeft = [0] +arrRight = [0] + +for nIndx in range(len(arrInt) - 1): + arrLeft.append(arrLeft[-1] + arrInt[nIndx]) + arrRight.append(arrRight[-1] + arrInt[len(arrInt) - nIndx - 1]) + +arrRight.reverse() + +arrLeftRightSumDiff = [abs(arrLeft[nIndx] - arrRight[nIndx]) for nIndx in range(len(arrLeft))] + +## print (arrLeft) +## print (arrRight) +print (arrLeftRightSumDiff) -- cgit