aboutsummaryrefslogtreecommitdiff
path: root/challenge-329/luca-ferrari/python/ch-1.py
blob: 41d2e6a1d8054174a4dc0f6786ad94290602fd77 (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
#!python

#
# Perl Weekly Challenge 329
# Task 1
#
# See <https://perlweeklychallenge.org/blog/perl-weekly-challenge-329>
#

import sys
import re

# task implementation
# the return value will be printed
def task_1( args ):
    string = args[ 0 ]

    numbers = []
    pattern = re.compile( r'\d+' )
    for i in pattern.findall( string ) :
        if not i in numbers :
            numbers.append( i )

    return numbers

# invoke the main without the command itself
if __name__ == '__main__':
    print( task_1( sys.argv[ 1: ] ) )