diff options
| author | 冯昶 <fengchang@novel-supertv.com> | 2024-06-19 10:19:37 +0800 |
|---|---|---|
| committer | 冯昶 <fengchang@novel-supertv.com> | 2024-06-19 10:19:37 +0800 |
| commit | 8fea6debb2f1582d761fcb3842dc1f8d9bc683ea (patch) | |
| tree | aa8434550ab5ac39df8b5fc66084bbdd6c7ecbf1 /challenge-273/luca-ferrari/python/ch-1.py | |
| parent | 2a6cdeb8e1b429bdb337b3e261f83bdd0a5b80d9 (diff) | |
| parent | ffc47a8850ee877978e371d11a01a028862a3f9d (diff) | |
| download | perlweeklychallenge-club-8fea6debb2f1582d761fcb3842dc1f8d9bc683ea.tar.gz perlweeklychallenge-club-8fea6debb2f1582d761fcb3842dc1f8d9bc683ea.tar.bz2 perlweeklychallenge-club-8fea6debb2f1582d761fcb3842dc1f8d9bc683ea.zip | |
Merge remote-tracking branch 'upstream/master'
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: ] ) ) |
