aboutsummaryrefslogtreecommitdiff
path: root/challenge-245/eric-cheung/python
diff options
context:
space:
mode:
author冯昶 <fengchang@novel-supertv.com>2023-12-04 15:09:23 +0800
committer冯昶 <fengchang@novel-supertv.com>2023-12-04 15:09:23 +0800
commit1b0f0c9cf0a1295b8bf9bef8d902f9a351120785 (patch)
tree538dfb19ef0c66b56d4d743ed37868350b463a0f /challenge-245/eric-cheung/python
parent6f78aae3efa4642ffa271896203a09afce53e407 (diff)
parentb41848354dc1a09ae68e01e91b551a36d13f8bda (diff)
downloadperlweeklychallenge-club-1b0f0c9cf0a1295b8bf9bef8d902f9a351120785.tar.gz
perlweeklychallenge-club-1b0f0c9cf0a1295b8bf9bef8d902f9a351120785.tar.bz2
perlweeklychallenge-club-1b0f0c9cf0a1295b8bf9bef8d902f9a351120785.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'challenge-245/eric-cheung/python')
-rwxr-xr-xchallenge-245/eric-cheung/python/ch-1.py12
-rwxr-xr-xchallenge-245/eric-cheung/python/ch-2.py8
2 files changed, 20 insertions, 0 deletions
diff --git a/challenge-245/eric-cheung/python/ch-1.py b/challenge-245/eric-cheung/python/ch-1.py
new file mode 100755
index 0000000000..35addf394d
--- /dev/null
+++ b/challenge-245/eric-cheung/python/ch-1.py
@@ -0,0 +1,12 @@
+
+## Example 1
+## arrLang = ["perl", "c", "python"]
+## arrPopularity = [2, 1, 3]
+
+## Example 2
+arrLang = ["c++", "haskell", "java"]
+arrPopularity = [1, 3, 2]
+
+arrOutput = [arrLangLoop for arrPopularityLoop, arrLangLoop in sorted(zip(arrPopularity, arrLang))]
+
+print (arrOutput)
diff --git a/challenge-245/eric-cheung/python/ch-2.py b/challenge-245/eric-cheung/python/ch-2.py
new file mode 100755
index 0000000000..9f531e288b
--- /dev/null
+++ b/challenge-245/eric-cheung/python/ch-2.py
@@ -0,0 +1,8 @@
+
+## arrDigits = [8, 1, 9] ## Example 1
+arrDigits = [8, 6, 7, 1, 0] ## Example 2
+
+if sum(arrDigits) % 3 == 0:
+ print ("".join(sorted([str(DigitLoop) for DigitLoop in arrDigits], reverse = True)))
+else:
+ print (-1)