diff options
Diffstat (limited to 'challenge-325/luca-ferrari/python/ch-1.py')
| -rw-r--r-- | challenge-325/luca-ferrari/python/ch-1.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/challenge-325/luca-ferrari/python/ch-1.py b/challenge-325/luca-ferrari/python/ch-1.py new file mode 100644 index 0000000000..3e3210e9c0 --- /dev/null +++ b/challenge-325/luca-ferrari/python/ch-1.py @@ -0,0 +1,34 @@ +#!python + +# +# Perl Weekly Challenge 325 +# Task 1 +# +# See <https://perlweeklychallenge.org/blog/perl-weekly-challenge-325> +# + +import sys + +# task implementation +# the return value will be printed +def task_1( args ): + bits = list( map( int, args ) ) + f_max = 0 + c_max = 0 + + for d in bits: + if d == 1: + c_max += 1 + else: + if c_max > f_max : + f_max = c_max + + c_max = 0 + + return f_max + + + +# invoke the main without the command itself +if __name__ == '__main__': + print( task_1( sys.argv[ 1: ] ) ) |
