aboutsummaryrefslogtreecommitdiff
path: root/challenge-289/zapwai/python/ch-1.py
diff options
context:
space:
mode:
authorDavid Ferrone <zapwai@gmail.com>2024-09-30 13:05:24 -0400
committerDavid Ferrone <zapwai@gmail.com>2024-09-30 13:05:24 -0400
commitef99aabc641bef7ebe24b809e401babda7dfc5fe (patch)
tree97e5453f91b96bd94a4d716c09a59c4a010fa3a7 /challenge-289/zapwai/python/ch-1.py
parentfb4ae25cbf52df4ae59b5b7dfbd32004b67be604 (diff)
downloadperlweeklychallenge-club-ef99aabc641bef7ebe24b809e401babda7dfc5fe.tar.gz
perlweeklychallenge-club-ef99aabc641bef7ebe24b809e401babda7dfc5fe.tar.bz2
perlweeklychallenge-club-ef99aabc641bef7ebe24b809e401babda7dfc5fe.zip
Week 289
Diffstat (limited to 'challenge-289/zapwai/python/ch-1.py')
-rw-r--r--challenge-289/zapwai/python/ch-1.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/challenge-289/zapwai/python/ch-1.py b/challenge-289/zapwai/python/ch-1.py
new file mode 100644
index 0000000000..8b520005c1
--- /dev/null
+++ b/challenge-289/zapwai/python/ch-1.py
@@ -0,0 +1,25 @@
+def proc(ints) :
+ print( "Input:", ints)
+ ans = max(ints)
+ new1 = []
+ for i in range(len(ints)):
+ if ints[i] != ans:
+ new1.append(ints[i])
+ if len(new1) > 0 :
+ m2 = max(new1)
+ new2 = []
+ for i in range(len(new1)):
+ if new1[i] != m2:
+ new2.append(new1[i])
+
+ if len(new2) > 0:
+ ans = max(new2)
+ print( "Output:", ans)
+
+ints = [5, 6, 4, 1]
+proc(ints)
+ints = [4, 5]
+proc(ints)
+ints = [1, 2, 2, 3]
+proc(ints)
+