diff options
| author | boblied <boblied@gmail.com> | 2023-03-20 08:28:53 -0500 |
|---|---|---|
| committer | boblied <boblied@gmail.com> | 2023-03-20 08:28:53 -0500 |
| commit | e679e218ca3ba0ba4da25e28bf5ebe740a3842ae (patch) | |
| tree | 11de20a63c0abdfca453334dd35570831f237ab6 /challenge-208/eric-cheung/python/ch-2.py | |
| parent | 1c868a3d5e041651b5847bbec416133f15ad8a3c (diff) | |
| parent | 9c5cd2108a8f6cf8b793c28051fdf8d767a4c8a9 (diff) | |
| download | perlweeklychallenge-club-e679e218ca3ba0ba4da25e28bf5ebe740a3842ae.tar.gz perlweeklychallenge-club-e679e218ca3ba0ba4da25e28bf5ebe740a3842ae.tar.bz2 perlweeklychallenge-club-e679e218ca3ba0ba4da25e28bf5ebe740a3842ae.zip | |
Merge branch 'master' of https://github.com/boblied/perlweeklychallenge-club
Diffstat (limited to 'challenge-208/eric-cheung/python/ch-2.py')
| -rwxr-xr-x | challenge-208/eric-cheung/python/ch-2.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/challenge-208/eric-cheung/python/ch-2.py b/challenge-208/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..951f8a03a0 --- /dev/null +++ b/challenge-208/eric-cheung/python/ch-2.py @@ -0,0 +1,13 @@ +
+## arrNum = [1, 2, 2, 4] ## Example 1
+## arrNum = [1, 2, 3, 4] ## Example 2
+arrNum = [1, 2, 3, 3] ## Example 3
+
+arrList = range(1, len(arrNum) + 1)
+
+arrDupMiss = list(set([nElemLoop for nElemLoop in arrNum if arrNum.count(nElemLoop) > 1])) + list(set(arrList).difference(set(arrNum)))
+
+if len(arrDupMiss) > 0:
+ print (arrDupMiss)
+else:
+ print (-1)
|
