aboutsummaryrefslogtreecommitdiff
path: root/challenge-284/eric-cheung/python/ch-2.py
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <mohammad.anwar@yahoo.com>2024-08-26 13:36:59 +0100
committerMohammad Sajid Anwar <mohammad.anwar@yahoo.com>2024-08-26 13:36:59 +0100
commitb702e4cb4824a9313869b6228e19bf96c27fa09a (patch)
treecfeff406270b295c2f3e966e81c9c0aae0c9ccba /challenge-284/eric-cheung/python/ch-2.py
parent15ecba2d6694e64c52574efd72163efff8f7c1da (diff)
downloadperlweeklychallenge-club-b702e4cb4824a9313869b6228e19bf96c27fa09a.tar.gz
perlweeklychallenge-club-b702e4cb4824a9313869b6228e19bf96c27fa09a.tar.bz2
perlweeklychallenge-club-b702e4cb4824a9313869b6228e19bf96c27fa09a.zip
- Added solutions by Eric Cheung.
- Added solutions by Simon Green. - Added solutions by PokGoPun. - Added solutions by Niels van Dijke. - Added solutions by Tymoteusz Moryto. - Added solutions by Feng Chang.
Diffstat (limited to 'challenge-284/eric-cheung/python/ch-2.py')
-rwxr-xr-xchallenge-284/eric-cheung/python/ch-2.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/challenge-284/eric-cheung/python/ch-2.py b/challenge-284/eric-cheung/python/ch-2.py
new file mode 100755
index 0000000000..9230393f83
--- /dev/null
+++ b/challenge-284/eric-cheung/python/ch-2.py
@@ -0,0 +1,24 @@
+
+## Example 1
+## arrList_01 = [2, 3, 9, 3, 1, 4, 6, 7, 2, 8, 5]
+## arrList_02 = [2, 1, 4, 3, 5, 6]
+
+## Example 2
+## arrList_01 = [3, 3, 4, 6, 2, 4, 2, 1, 3]
+## arrList_02 = [1, 3, 2]
+
+## Example 3
+arrList_01 = [3, 0, 5, 0, 2, 1, 4, 1, 1]
+arrList_02 = [1, 0, 3, 2]
+
+arrOutput = []
+
+## Contain
+for nLoop in arrList_02:
+ arrOutput = arrOutput + [nLoop] * arrList_01.count(nLoop)
+
+## Miss
+for nLoop in [rLoop for rLoop in set(arrList_01) if rLoop not in arrList_02]:
+ arrOutput = arrOutput + [nLoop] * arrList_01.count(nLoop)
+
+print (arrOutput)