aboutsummaryrefslogtreecommitdiff
path: root/challenge-272/eric-cheung/python
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2024-06-04 11:39:01 +0100
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2024-06-04 11:39:01 +0100
commit6df20ab470a59710a2f39c47c88a3f73c716f57c (patch)
tree58453e03c74201d644e5ee3ab77d54408cde300d /challenge-272/eric-cheung/python
parent87f74ee8c9273acc86f1cea97b49fc0a9c753741 (diff)
downloadperlweeklychallenge-club-6df20ab470a59710a2f39c47c88a3f73c716f57c.tar.gz
perlweeklychallenge-club-6df20ab470a59710a2f39c47c88a3f73c716f57c.tar.bz2
perlweeklychallenge-club-6df20ab470a59710a2f39c47c88a3f73c716f57c.zip
- Added solutions by Mark Anderson.
- Added solutions by Niels van Dijke. - Added solutions by Eric Cheung. - Added solutions by Laurent Rosenfeld. - Added solutions by E. Choroba. - Added solutions by Feng Chang. - Added solutions by W. Luis Mochan. - Added solutions by Steven Wilson. - Added solutions by Peter Meszaros. - Added solutions by Peter Campbell Smith. - Added solutions by David Ferrone. - Added solutions by Matthew Neleigh. - Added solutions by Thomas Kohler. - Added solutions by Ali Moradi. - Added solutions by Dave Jacoby. - Added solutions by Jaldhar H. Vyas.
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))