diff options
| author | Mohammad Sajid Anwar <Mohammad.Anwar@yahoo.com> | 2024-06-24 22:28:03 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-24 22:28:03 +0100 |
| commit | 516e5f90c2e01f445c9d554282fc6bec60a79672 (patch) | |
| tree | 26d07cb3b9ce89bcd533e0a30eba7545466d3ee4 /challenge-275/luca-ferrari/python/ch-2.py | |
| parent | efeb4b1121b3df61e39c3ea65d82245ad0ac7359 (diff) | |
| parent | e3413e5215e89c8512218669be7701def126c9cd (diff) | |
| download | perlweeklychallenge-club-516e5f90c2e01f445c9d554282fc6bec60a79672.tar.gz perlweeklychallenge-club-516e5f90c2e01f445c9d554282fc6bec60a79672.tar.bz2 perlweeklychallenge-club-516e5f90c2e01f445c9d554282fc6bec60a79672.zip | |
Merge pull request #10315 from fluca1978/PWC275
PWC 275
Diffstat (limited to 'challenge-275/luca-ferrari/python/ch-2.py')
| -rw-r--r-- | challenge-275/luca-ferrari/python/ch-2.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/challenge-275/luca-ferrari/python/ch-2.py b/challenge-275/luca-ferrari/python/ch-2.py new file mode 100644 index 0000000000..ebe16641b0 --- /dev/null +++ b/challenge-275/luca-ferrari/python/ch-2.py @@ -0,0 +1,32 @@ +#!python + +# +# Perl Weekly Challenge 275 +# Task 2 +# +# See <https://perlweeklychallenge.org/blog/perl-weekly-challenge-275> +# + +import sys + +# task implementation +# the return value will be printed +def task_2( args ): + string = args[ 0 ] + previous = None + result = "" + + for c in string: + if c.isdigit(): + c = chr( int( c ) + 97 ) + else: + previous = c + + result += c + + return result + + +# invoke the main without the command itself +if __name__ == '__main__': + print( task_2( sys.argv[ 1: ] ) ) |
