aboutsummaryrefslogtreecommitdiff
path: root/challenge-261/eric-cheung/python
diff options
context:
space:
mode:
authorDave Jacoby <jacoby.david@gmail.com>2024-03-18 13:26:14 -0400
committerGitHub <noreply@github.com>2024-03-18 13:26:14 -0400
commit4e3f2749e5e6a4c4e9c53ffd5a3dde78204efb0e (patch)
tree2e2743718c62dd4698210bb4b03617d0a8d96963 /challenge-261/eric-cheung/python
parent9e7e80939c8a0ae12ace548d7b9efb43b32ec4c3 (diff)
parentb91a4623cd4c2b51f779f59b53310a0bd745f03f (diff)
downloadperlweeklychallenge-club-4e3f2749e5e6a4c4e9c53ffd5a3dde78204efb0e.tar.gz
perlweeklychallenge-club-4e3f2749e5e6a4c4e9c53ffd5a3dde78204efb0e.tar.bz2
perlweeklychallenge-club-4e3f2749e5e6a4c4e9c53ffd5a3dde78204efb0e.zip
Merge branch 'manwar:master' into master
Diffstat (limited to 'challenge-261/eric-cheung/python')
-rwxr-xr-xchallenge-261/eric-cheung/python/ch-1.py13
-rwxr-xr-xchallenge-261/eric-cheung/python/ch-2.py18
2 files changed, 31 insertions, 0 deletions
diff --git a/challenge-261/eric-cheung/python/ch-1.py b/challenge-261/eric-cheung/python/ch-1.py
new file mode 100755
index 0000000000..348279526f
--- /dev/null
+++ b/challenge-261/eric-cheung/python/ch-1.py
@@ -0,0 +1,13 @@
+
+## arrInt = [1, 2, 3, 45] ## Example 1
+## arrInt = [1, 12, 3] ## Example 2
+## arrInt = [1, 2, 3, 4] ## Example 3
+arrInt = [236, 416, 336, 350] ## Example 4
+
+arrSplit = []
+for nLoop in arrInt:
+ arrSplit = arrSplit + [int(elem) for elem in str(nLoop)]
+
+## print (sum(arrInt))
+## print (sum(arrSplit))
+print (abs(sum(arrInt) - sum(arrSplit)))
diff --git a/challenge-261/eric-cheung/python/ch-2.py b/challenge-261/eric-cheung/python/ch-2.py
new file mode 100755
index 0000000000..a275000b69
--- /dev/null
+++ b/challenge-261/eric-cheung/python/ch-2.py
@@ -0,0 +1,18 @@
+
+## Example 1
+## arrInt = [5, 3, 6, 1, 12]
+## nStart = 3
+
+## Example 2
+## arrInt = [1, 2, 4, 3]
+## nStart = 1
+
+## Example 3
+arrInt = [5, 6, 7]
+nStart = 2
+
+nFinal = nStart
+while nFinal in arrInt:
+ nFinal = nFinal * 2
+
+print (nFinal)