From 080fde56fb9825f48e63c97840234fbde25fedaa Mon Sep 17 00:00:00 2001 From: Luca Ferrari Date: Mon, 8 Jan 2024 10:17:22 +0100 Subject: PWC 251 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 --- challenge-251/luca-ferrari/python/ch-1.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 challenge-251/luca-ferrari/python/ch-1.py (limited to 'challenge-251/luca-ferrari/python/ch-1.py') diff --git a/challenge-251/luca-ferrari/python/ch-1.py b/challenge-251/luca-ferrari/python/ch-1.py new file mode 100644 index 0000000000..e72f979066 --- /dev/null +++ b/challenge-251/luca-ferrari/python/ch-1.py @@ -0,0 +1,25 @@ +#!python + +# +# Perl Weekly Challenge 251 +# Task 1 +# +# See +# + +import sys + +# task implementation +def main( argv ): + sum = 0 + for i in range( 0, len( argv ) - 1 ): + if i % 2 != 0: + continue + sum += int( argv[ i ] + argv[ i + 1 ] ) + + return sum + + +# invoke the main without the command itself +if __name__ == '__main__': + print( main( sys.argv[ 1: ] ) ) -- cgit