diff options
Diffstat (limited to 'challenge-193/eric-cheung/python/ch-2.py')
| -rwxr-xr-x | challenge-193/eric-cheung/python/ch-2.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/challenge-193/eric-cheung/python/ch-2.py b/challenge-193/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..a28f7f0aac --- /dev/null +++ b/challenge-193/eric-cheung/python/ch-2.py @@ -0,0 +1,19 @@ +
+def GetDiffStr(strInput):
+ return ",".join([str(ord(strInput[nIndx]) - ord(strInput[nIndx - 1])) for nIndx in range(1, len(strInput))])
+
+## arrInputStr = ["adc", "wzy", "abc"] ## Example 1
+arrInputStr = ["aaa", "bob", "ccc", "ddd"] ## Example 2
+
+arrStrAppend = []
+strOdd = ""
+
+for strLoop in arrInputStr:
+ arrStrAppend.append(GetDiffStr(strLoop))
+
+for nIndxLoop, strLoop in enumerate(arrStrAppend):
+ if arrStrAppend.count(strLoop) == 1:
+ strOdd = arrInputStr[nIndxLoop]
+ break
+
+print (strOdd)
|
