From dbe495712e34674a941fb1c17e0cd5bca5c55ae4 Mon Sep 17 00:00:00 2001 From: Luca Ferrari Date: Mon, 11 Mar 2024 11:11:03 +0100 Subject: PWC 260 Task 1 Raku done Task 2 Raku done Task 1 PL/Perl done Task 2 PL/Perl done Task 1 PL/PgSQL done Task 2 PL/PgSQL done Task 1 Python done Task 2 Python done Task 1 PL/Java done Task 2 PL/Java done --- challenge-260/luca-ferrari/python/ch-1.py | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 challenge-260/luca-ferrari/python/ch-1.py (limited to 'challenge-260/luca-ferrari/python/ch-1.py') diff --git a/challenge-260/luca-ferrari/python/ch-1.py b/challenge-260/luca-ferrari/python/ch-1.py new file mode 100644 index 0000000000..8f70bb0494 --- /dev/null +++ b/challenge-260/luca-ferrari/python/ch-1.py @@ -0,0 +1,33 @@ +#!python + +# +# Perl Weekly Challenge 260 +# Task 1 +# +# See +# + +import sys + +# task implementation +# the return value will be printed +def task_1( args ): + nums = list( map( int, args ) ) + bag = {} + + for n in nums: + occurrencies = len( list( filter( lambda x: x == n, nums ) ) ) + if not n in bag: + bag[ n ] = occurrencies + + + for o in bag.values(): + if len( list( filter( lambda x: x == o, bag.values() ) ) ) > 1: + return 0 + + return 1 + + +# invoke the main without the command itself +if __name__ == '__main__': + print( task_1( sys.argv[ 1: ] ) ) -- cgit