aboutsummaryrefslogtreecommitdiff
path: root/challenge-268/eric-cheung/python/ch-2.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-268/eric-cheung/python/ch-2.py')
-rwxr-xr-xchallenge-268/eric-cheung/python/ch-2.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/challenge-268/eric-cheung/python/ch-2.py b/challenge-268/eric-cheung/python/ch-2.py
new file mode 100755
index 0000000000..de091f76fe
--- /dev/null
+++ b/challenge-268/eric-cheung/python/ch-2.py
@@ -0,0 +1,15 @@
+
+## arrInt = [2, 5, 3, 4] ## Example 1
+## arrInt = [9, 4, 1, 3, 6, 4, 6, 1] ## Example 2
+arrInt = [1, 2, 2, 3] ## Example 3
+
+arrInt = sorted(arrInt)
+arrOutput = []
+
+while len(arrInt) > 0:
+ arrOutput.append(arrInt[1])
+ arrOutput.append(arrInt[0])
+ del arrInt[1]
+ del arrInt[0]
+
+print (arrOutput)