aboutsummaryrefslogtreecommitdiff
path: root/challenge-275/luca-ferrari/python/ch-2.py
blob: ebe16641b09b4ca671f4eac09c40caaec36cb732 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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: ] ) )