aboutsummaryrefslogtreecommitdiff
path: root/challenge-320/sgreen/python/ch-1.py
diff options
context:
space:
mode:
authorDave Jacoby <jacoby.david@gmail.com>2025-05-15 16:45:20 -0400
committerGitHub <noreply@github.com>2025-05-15 16:45:20 -0400
commitefc2a652edb6436965e12883bedf035ea081284d (patch)
tree7e9940d4f72fe1e8d984b3746af2d30dff96330b /challenge-320/sgreen/python/ch-1.py
parent6886bd3e06ccf8b0a564f3c434cd53131d126f70 (diff)
parented7588dadb77d63adca3d3aefc6cd325164e0947 (diff)
downloadperlweeklychallenge-club-efc2a652edb6436965e12883bedf035ea081284d.tar.gz
perlweeklychallenge-club-efc2a652edb6436965e12883bedf035ea081284d.tar.bz2
perlweeklychallenge-club-efc2a652edb6436965e12883bedf035ea081284d.zip
Merge branch 'manwar:master' into master
Diffstat (limited to 'challenge-320/sgreen/python/ch-1.py')
-rwxr-xr-xchallenge-320/sgreen/python/ch-1.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/challenge-320/sgreen/python/ch-1.py b/challenge-320/sgreen/python/ch-1.py
new file mode 100755
index 0000000000..60156de33e
--- /dev/null
+++ b/challenge-320/sgreen/python/ch-1.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python3
+
+import sys
+
+
+def maximum_count(ints: list) -> int:
+ """Return the maximum between the number of positive and negative integers
+
+ Args:
+ ints (list): A list of integers
+
+ Returns:
+ int: The maximum
+ """
+
+ # Count the number of positive and negative integers
+ pos_count = sum(1 for i in ints if i > 0)
+ neg_count = sum(1 for i in ints if i < 0)
+
+ # Return the maximum of these two values
+ return max(pos_count, neg_count)
+
+def main():
+ # Convert input into integers
+ array = [int(n) for n in sys.argv[1:]]
+ result = maximum_count(array)
+ print(result)
+
+
+if __name__ == '__main__':
+ main()