aboutsummaryrefslogtreecommitdiff
path: root/challenge-272/eric-cheung/python
diff options
context:
space:
mode:
authorMatthew Neleigh <87619159+mattneleigh@users.noreply.github.com>2024-06-05 13:04:21 -0400
committerGitHub <noreply@github.com>2024-06-05 13:04:21 -0400
commitb7ddc0df59586129822cd79732dee50ddabbf18c (patch)
treee78636a66f5b729b049459837b524e701dc22082 /challenge-272/eric-cheung/python
parent74e6d81b2e785bd2f7dd4398ea5e2733618ac4b3 (diff)
parent7aeb2014a04d815bc006a3c337b73426a10ea591 (diff)
downloadperlweeklychallenge-club-b7ddc0df59586129822cd79732dee50ddabbf18c.tar.gz
perlweeklychallenge-club-b7ddc0df59586129822cd79732dee50ddabbf18c.tar.bz2
perlweeklychallenge-club-b7ddc0df59586129822cd79732dee50ddabbf18c.zip
Merge branch 'manwar:master' into pwc272
Diffstat (limited to 'challenge-272/eric-cheung/python')
-rwxr-xr-xchallenge-272/eric-cheung/python/ch-1.py7
-rwxr-xr-xchallenge-272/eric-cheung/python/ch-2.py9
2 files changed, 16 insertions, 0 deletions
diff --git a/challenge-272/eric-cheung/python/ch-1.py b/challenge-272/eric-cheung/python/ch-1.py
new file mode 100755
index 0000000000..6ac6998ad4
--- /dev/null
+++ b/challenge-272/eric-cheung/python/ch-1.py
@@ -0,0 +1,7 @@
+
+## strIP = "1.1.1.1" ## Example 1
+strIP = "255.101.1.0" ## Example 2
+
+strOutput = strIP.replace(".", "[.]")
+
+print (strOutput)
diff --git a/challenge-272/eric-cheung/python/ch-2.py b/challenge-272/eric-cheung/python/ch-2.py
new file mode 100755
index 0000000000..52f8329ed9
--- /dev/null
+++ b/challenge-272/eric-cheung/python/ch-2.py
@@ -0,0 +1,9 @@
+
+## strInput = "hello" ## Example 1
+## strInput = "perl" ## Example 2
+strInput = "raku" ## Example 3
+
+arrCode = [ord(charLoop) for charLoop in strInput]
+arrCodeAbsDiff = [abs(arrCode[nIndx] - arrCode[nIndx + 1]) for nIndx in range(len(arrCode) - 1)]
+
+print (sum(arrCodeAbsDiff))