aboutsummaryrefslogtreecommitdiff
path: root/challenge-275
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2024-06-24 22:49:14 +0100
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2024-06-24 22:49:14 +0100
commitb07b0b03e415426e49e0c43f71de0a27a3cc65a4 (patch)
treed628feac980890b27f04896e3f9a4d78371f239a /challenge-275
parent4b157dc2dab7a337e488dfb8f388c217ceff6292 (diff)
downloadperlweeklychallenge-club-b07b0b03e415426e49e0c43f71de0a27a3cc65a4.tar.gz
perlweeklychallenge-club-b07b0b03e415426e49e0c43f71de0a27a3cc65a4.tar.bz2
perlweeklychallenge-club-b07b0b03e415426e49e0c43f71de0a27a3cc65a4.zip
- Added solutions by Joelle Maslak.
- Added solutions by Thomas Kohler. - Added solutions by Niels van Dijke. - Added solutions by Feng Chang. - Added solutions by PokGoPun. - Added solutions by Luca Ferrari. - Added solutions by Mark Anderson. - Added solutions by Steven Wilson. - Added solutions by Peter Campbell Smith. - Added solutions by Peter Meszaros. - Added solutions by E. Choroba. - Added solutions by W. Luis Mochan. - Added solutions by Eric Cheung.
Diffstat (limited to 'challenge-275')
-rwxr-xr-xchallenge-275/eric-cheung/python/ch-1.py27
-rwxr-xr-xchallenge-275/eric-cheung/python/ch-2.py18
-rwxr-xr-xchallenge-275/perlboy1967/perl/ch-1.pl (renamed from challenge-275/perlboy1967/perl/ch1.pl)0
-rwxr-xr-xchallenge-275/perlboy1967/perl/ch-2.pl (renamed from challenge-275/perlboy1967/perl/ch2.pl)0
4 files changed, 45 insertions, 0 deletions
diff --git a/challenge-275/eric-cheung/python/ch-1.py b/challenge-275/eric-cheung/python/ch-1.py
new file mode 100755
index 0000000000..ae16d9a130
--- /dev/null
+++ b/challenge-275/eric-cheung/python/ch-1.py
@@ -0,0 +1,27 @@
+
+## Example 1
+## strSentence = "Perl Weekly Challenge"
+## arrKey = ["l", "a"]
+
+## Example 2
+## strSentence = "Perl and Raku"
+## arrKey = ["a"]
+
+## Example 3
+## strSentence = "Well done Team PWC"
+## arrKey = ["l", "o"]
+
+## Example 4
+strSentence = "The joys of polyglottism"
+arrKey = ["T"]
+
+arrKeyLower = [charLoop.lower() for charLoop in arrKey]
+
+nCount = 0
+for wordLoop in strSentence.split():
+ ## print (wordLoop)
+ arrContain = [charLoop for charLoop in wordLoop.lower() if charLoop in arrKeyLower]
+ if len(arrContain) == 0:
+ nCount = nCount + 1
+
+print (nCount)
diff --git a/challenge-275/eric-cheung/python/ch-2.py b/challenge-275/eric-cheung/python/ch-2.py
new file mode 100755
index 0000000000..c243ed3899
--- /dev/null
+++ b/challenge-275/eric-cheung/python/ch-2.py
@@ -0,0 +1,18 @@
+
+## strInput = "a1c1e1" ## Example 1
+## strInput = "a1b2c3d4" ## Example 2
+## strInput = "b2b" ## Example 3
+strInput = "a16z" ## Example 4
+
+arrList = list(strInput)
+arrPosNum = [nIndx for nIndx, charLoop in enumerate(strInput) if charLoop.isdigit()]
+arrPosChar = [nIndx for nIndx, charLoop in enumerate(strInput) if charLoop.isalpha()]
+
+## print (arrPosNum)
+## print (arrPosChar)
+
+for nIndx in arrPosNum:
+ LastChar = strInput[[nLoop for nLoop in arrPosChar if nLoop < nIndx][-1]]
+ arrList[nIndx] = chr(ord(LastChar) + int(arrList[nIndx]))
+
+print ("".join(arrList))
diff --git a/challenge-275/perlboy1967/perl/ch1.pl b/challenge-275/perlboy1967/perl/ch-1.pl
index 624b8fb931..624b8fb931 100755
--- a/challenge-275/perlboy1967/perl/ch1.pl
+++ b/challenge-275/perlboy1967/perl/ch-1.pl
diff --git a/challenge-275/perlboy1967/perl/ch2.pl b/challenge-275/perlboy1967/perl/ch-2.pl
index ccd347c497..ccd347c497 100755
--- a/challenge-275/perlboy1967/perl/ch2.pl
+++ b/challenge-275/perlboy1967/perl/ch-2.pl