aboutsummaryrefslogtreecommitdiff
path: root/challenge-239/eric-cheung/python
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2023-10-16 23:39:40 +0100
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2023-10-16 23:39:40 +0100
commiteb89c85d8f90b18bb075d6bc49e009e38294ad39 (patch)
tree78c361e3755dd8973a0aeeb3bec1e945ff210c43 /challenge-239/eric-cheung/python
parent9c3e2ca8f3eb9a2dd8ae0073b36816f21367a3b6 (diff)
downloadperlweeklychallenge-club-eb89c85d8f90b18bb075d6bc49e009e38294ad39.tar.gz
perlweeklychallenge-club-eb89c85d8f90b18bb075d6bc49e009e38294ad39.tar.bz2
perlweeklychallenge-club-eb89c85d8f90b18bb075d6bc49e009e38294ad39.zip
- Added solutions by Robert DiCicco.
- Added solutions by Ulrich Rieke. - Added solutions by Eric Cheung. - Added solutions by W. Luis Mochan. - Added solutions by Matthias Muth. - Added solutions by rcmlz. - Added solutions by Niels van Dijke. - Added solutions by E. Choroba. - Added solutions by Mark Anderson. - Added solutions by Jaldhar H. Vyas. - Added solutions by PokGoPun. - Added solutions by David Ferrone. - Added solutions by Dave Jacoby. - Added solutions by Peter Meszaros. - Added solutions by Thomas Kohler.
Diffstat (limited to 'challenge-239/eric-cheung/python')
-rwxr-xr-xchallenge-239/eric-cheung/python/ch-1.py14
-rwxr-xr-xchallenge-239/eric-cheung/python/ch-2.py21
2 files changed, 35 insertions, 0 deletions
diff --git a/challenge-239/eric-cheung/python/ch-1.py b/challenge-239/eric-cheung/python/ch-1.py
new file mode 100755
index 0000000000..7d0991df77
--- /dev/null
+++ b/challenge-239/eric-cheung/python/ch-1.py
@@ -0,0 +1,14 @@
+
+## Example 1
+## arrInput_01 = ["ab", "c"]
+## arrInput_02 = ["a", "bc"]
+
+## Example 2
+## arrInput_01 = ["ab", "c"]
+## arrInput_02 = ["ac", "b"]
+
+## Example 3
+arrInput_01 = ["ab", "cd", "e"]
+arrInput_02 = ["abcde"]
+
+print ("".join(arrInput_01) == "".join(arrInput_02))
diff --git a/challenge-239/eric-cheung/python/ch-2.py b/challenge-239/eric-cheung/python/ch-2.py
new file mode 100755
index 0000000000..dac1eb5222
--- /dev/null
+++ b/challenge-239/eric-cheung/python/ch-2.py
@@ -0,0 +1,21 @@
+
+## Example 1
+## arrStr = ["ad", "bd", "aaab", "baa", "badab"]
+## strAllowed = "ab"
+
+## Example 2
+## arrStr = ["a", "b", "c", "ab", "ac", "bc", "abc"]
+## strAllowed = "abc"
+
+## Example 3
+arrStr = ["cc", "acd", "b", "ba", "bac", "bad", "ac", "d"]
+strAllowed = "cad"
+
+arrOutput = []
+
+for strLoop in arrStr:
+ arrTemp = [charLoop for charLoop in set(strLoop) if charLoop not in strAllowed]
+ if len(arrTemp) == 0:
+ arrOutput.append(strLoop)
+
+print (len(arrOutput))