diff options
Diffstat (limited to 'challenge-252/luca-ferrari/python/ch-1.py')
| -rw-r--r-- | challenge-252/luca-ferrari/python/ch-1.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/challenge-252/luca-ferrari/python/ch-1.py b/challenge-252/luca-ferrari/python/ch-1.py new file mode 100644 index 0000000000..cae2cc2c1c --- /dev/null +++ b/challenge-252/luca-ferrari/python/ch-1.py @@ -0,0 +1,27 @@ +#!python + +# +# Perl Weekly Challenge 252 +# Task 1 +# +# See <https://perlweeklychallenge.org/blog/perl-weekly-challenge-252/> +# + +import sys + +# task implementation +# the return value will be printed +def main( argv ): + nums = list( map( int, argv ) ) + sum = 0 + for i in range( 0, len( nums ) ): + if len( nums ) % ( i + 1 ) == 0: + sum += nums[ i ] ** 2; + + return sum + + +# invoke the main without the command itself +if __name__ == '__main__': + print( main( sys.argv[ 1: ] ) ) + |
