aboutsummaryrefslogtreecommitdiff
path: root/challenge-279/eric-cheung/python/ch-1.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-279/eric-cheung/python/ch-1.py')
-rwxr-xr-xchallenge-279/eric-cheung/python/ch-1.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/challenge-279/eric-cheung/python/ch-1.py b/challenge-279/eric-cheung/python/ch-1.py
new file mode 100755
index 0000000000..50d0bbbc82
--- /dev/null
+++ b/challenge-279/eric-cheung/python/ch-1.py
@@ -0,0 +1,18 @@
+
+## Example 1
+## arrLetters = ["R", "E", "P", "L"]
+## arrWeights = [3, 2, 1, 4]
+
+## Example 2
+## arrLetters = ["A", "U", "R", "K"]
+## arrWeights = [2, 4, 1, 3]
+
+## Example 3
+arrLetters = ["O", "H", "Y", "N", "P", "T"]
+arrWeights = [5, 4, 2, 6, 1, 3]
+
+arrSort = sorted([[nWeightLoop, charLoop] for charLoop, nWeightLoop in zip(arrLetters, arrWeights)])
+
+strOutput = "".join([charLoop for nWeightLoop, charLoop in arrSort])
+
+print (strOutput)