aboutsummaryrefslogtreecommitdiff
path: root/challenge-228/eric-cheung/python
diff options
context:
space:
mode:
author冯昶 <fengchang@novel-supertv.com>2023-08-07 15:12:39 +0800
committer冯昶 <fengchang@novel-supertv.com>2023-08-07 15:12:39 +0800
commit6ef46b171c093a7fc72e6b52662b9020fe71753a (patch)
treec69b365edfce5a183ad3e2aeb9f667f8885c3589 /challenge-228/eric-cheung/python
parentcb5bb2d77bf43ab282150372f5cd87bbbcb7a477 (diff)
parent2b2c6ec6ece04737ba9a572109d5e7072fdaa14a (diff)
downloadperlweeklychallenge-club-6ef46b171c093a7fc72e6b52662b9020fe71753a.tar.gz
perlweeklychallenge-club-6ef46b171c093a7fc72e6b52662b9020fe71753a.tar.bz2
perlweeklychallenge-club-6ef46b171c093a7fc72e6b52662b9020fe71753a.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'challenge-228/eric-cheung/python')
-rwxr-xr-xchallenge-228/eric-cheung/python/ch-1.py8
-rwxr-xr-xchallenge-228/eric-cheung/python/ch-2.py13
2 files changed, 21 insertions, 0 deletions
diff --git a/challenge-228/eric-cheung/python/ch-1.py b/challenge-228/eric-cheung/python/ch-1.py
new file mode 100755
index 0000000000..ae4d0ec1d9
--- /dev/null
+++ b/challenge-228/eric-cheung/python/ch-1.py
@@ -0,0 +1,8 @@
+
+## arrInt = [2, 1, 3, 2] ## Example 1
+## arrInt = [1, 1, 1, 1] ## Example 2
+arrInt = [2, 1, 3, 4] ## Example 3
+
+arrUniqInt = [nLoop for nLoop in list(set(arrInt)) if arrInt.count(nLoop) == 1]
+
+print (sum(arrUniqInt))
diff --git a/challenge-228/eric-cheung/python/ch-2.py b/challenge-228/eric-cheung/python/ch-2.py
new file mode 100755
index 0000000000..6f74b418c1
--- /dev/null
+++ b/challenge-228/eric-cheung/python/ch-2.py
@@ -0,0 +1,13 @@
+
+## arrInt = [3, 4, 2] ## Example 1
+arrInt = [1, 2, 3] ## Example 2
+
+nCount = 0
+
+while len(arrInt) > 0:
+ if arrInt[0] > min(arrInt):
+ arrInt.append(arrInt[0])
+ del arrInt[0]
+ nCount = nCount + 1
+
+print (nCount)