aboutsummaryrefslogtreecommitdiff
path: root/challenge-235/eric-cheung/python/ch-2.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-235/eric-cheung/python/ch-2.py')
-rwxr-xr-xchallenge-235/eric-cheung/python/ch-2.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/challenge-235/eric-cheung/python/ch-2.py b/challenge-235/eric-cheung/python/ch-2.py
new file mode 100755
index 0000000000..ac11360c2d
--- /dev/null
+++ b/challenge-235/eric-cheung/python/ch-2.py
@@ -0,0 +1,14 @@
+
+## arrInput = [1, 0, 2, 3, 0, 4, 5, 0] ## Example 1
+## arrInput = [1, 2, 3] ## Example 2
+arrInput = [0, 3, 0, 4, 5] ## Example 3
+
+arrTemp = arrInput[:]
+
+for nIndx in range(len(arrInput) - 1, -1, -1):
+ if arrTemp[nIndx] == 0:
+ arrTemp.insert(nIndx, 0)
+
+arrOutput = arrTemp[:len(arrInput)]
+
+print (arrOutput)