aboutsummaryrefslogtreecommitdiff
path: root/challenge-277/luca-ferrari/python/ch-2.py
blob: 1b420ab4b7daf1208b6d9ff24380a47384b91cd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import sys

# task implementation
# the return value will be printed
def task_2( args ):
    nums = list( map( int, args ) )

    strong = []

    for i in range( 0, len( nums ) - 1 ):
        for j in range( i + 1, len( nums ) ):
            if nums[ i ] != nums[ j ] and abs( nums[ i ] - nums[ j ] ) < min( nums[ i ], nums[ j ] ):
               strong.append( str( nums[ i ] ) + "<->" + str( nums[ j ] ) )

    return len( strong )


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