diff options
Diffstat (limited to 'challenge-243/luca-ferrari/python/ch-2.py')
| -rw-r--r-- | challenge-243/luca-ferrari/python/ch-2.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/challenge-243/luca-ferrari/python/ch-2.py b/challenge-243/luca-ferrari/python/ch-2.py new file mode 100644 index 0000000000..0e5f2c5863 --- /dev/null +++ b/challenge-243/luca-ferrari/python/ch-2.py @@ -0,0 +1,28 @@ +#!python + +# +# Perl Weekly Challenge 243 +# Task 2 +# +# See <https://perlweeklychallenge.org/blog/perl-weekly-challenge-243/> +# + +import sys +from functools import reduce + +# task implementation +def main( argv ): + nums = list( map( int, argv ) ) + sum = 0 + + + for current in nums: + sum = sum + reduce( lambda a,b: a + b, list( map( lambda x: int( current /x ), nums ) ) ) + + print( sum ) + +# invoke the main without the command itself +if __name__ == '__main__': + main( sys.argv[ 1: ] ) + + |
