diff options
Diffstat (limited to 'challenge-185/eric-cheung/python/ch-2.py')
| -rwxr-xr-x | challenge-185/eric-cheung/python/ch-2.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/challenge-185/eric-cheung/python/ch-2.py b/challenge-185/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..54f39f2974 --- /dev/null +++ b/challenge-185/eric-cheung/python/ch-2.py @@ -0,0 +1,23 @@ +
+## arrListInput = ['ab-cde-123', '123.abc.420', '3abc-0010.xy'] ## Example 1
+arrListInput = ['1234567.a', 'a-1234-bc', 'a.b.c.d.e.f'] ## Example 2
+
+arrListOutput = []
+nMaxToMask = 4
+
+for strLoop in arrListInput:
+
+ strResult = ""
+ nMaskCount = 0
+
+ for charLoop in strLoop:
+
+ if charLoop.isalnum() and nMaskCount < nMaxToMask:
+ strResult = strResult + "x"
+ nMaskCount = nMaskCount + 1
+ else:
+ strResult = strResult + charLoop
+
+ arrListOutput.append(strResult)
+
+print (arrListOutput)
|
