aboutsummaryrefslogtreecommitdiff
path: root/challenge-330/eric-cheung/python/ch-1.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-330/eric-cheung/python/ch-1.py')
-rwxr-xr-xchallenge-330/eric-cheung/python/ch-1.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/challenge-330/eric-cheung/python/ch-1.py b/challenge-330/eric-cheung/python/ch-1.py
new file mode 100755
index 0000000000..7cb84e86b6
--- /dev/null
+++ b/challenge-330/eric-cheung/python/ch-1.py
@@ -0,0 +1,16 @@
+
+## strInput = "cab12" ## Example 1
+## strInput = "xy99" ## Example 2
+strInput = "pa1erl" ## Example 3
+
+arrInput = list(strInput)
+
+while len([charLoop for charLoop in arrInput if charLoop.isdigit()]) > 0:
+ nFirstNumDigit = [nIndx for nIndx, charLoop in enumerate(arrInput) if charLoop.isdigit()][0]
+ if nFirstNumDigit == 0:
+ break
+
+ del arrInput[nFirstNumDigit]
+ del arrInput[nFirstNumDigit - 1]
+
+print ("".join(arrInput))