diff options
Diffstat (limited to 'challenge-273/luca-ferrari/python/ch-1.py')
| -rw-r--r-- | challenge-273/luca-ferrari/python/ch-1.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/challenge-273/luca-ferrari/python/ch-1.py b/challenge-273/luca-ferrari/python/ch-1.py new file mode 100644 index 0000000000..00e24b5173 --- /dev/null +++ b/challenge-273/luca-ferrari/python/ch-1.py @@ -0,0 +1,23 @@ +#!python + +# +# Perl Weekly Challenge 273 +# Task 1 +# +# See <https://perlweeklychallenge.org/blog/perl-weekly-challenge-273> +# + +import sys + +# task implementation +# the return value will be printed +def task_1( args ): + s = args[ 0 ] + c = args[ 1 ] + + return round( len( list( filter( lambda x: x == c, s ) ) ) / len( s ) * 100 ) + + +# invoke the main without the command itself +if __name__ == '__main__': + print( task_1( sys.argv[ 1: ] ) ) |
