aboutsummaryrefslogtreecommitdiff
path: root/challenge-289/luca-ferrari/python/ch-1.py
blob: 1713851c1f385e353f47dc0f2ef09afa063a0123 (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
25
26
#!python

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

import sys

# task implementation
# the return value will be printed
def task_1( args ):
    sorted_nums = list( sorted( map( int, args ) ) )
    sorted_nums = sorted_nums[ ::-1 ]

    if len( sorted_nums ) >= 3:
        return sorted_nums[ 2 ]
    else:
        return sorted_nums[ 0 ]


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