aboutsummaryrefslogtreecommitdiff
path: root/challenge-262/luca-ferrari/python/ch-1.py
blob: cf22506a4ceb1bf66f3b5cfd6a316836e34b6fa2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!python

#
# Perl Weekly Challenge 262
# Task 1
#
# See <https://perlweeklychallenge.org/blog/perl-weekly-challenge-262>
#

import sys

# task implementation
# the return value will be printed
def task_1( args ):
    nums = list( map( int, args ) )
    positives = len( list( filter( lambda x: True if x >= 0 else False, nums ) ) )
    negatives = len( list( filter( lambda x: True if x < 0  else False, nums ) ) )

    return positives if positives >= negatives else negatives


# invoke the main without the command itself
if __name__ == '__main__':
    print( task_1( sys.argv[ 1: ] ) )