From b1b52f1c2205682f9bf4477d5232a460d5fe8a58 Mon Sep 17 00:00:00 2001 From: Roger Bell_West Date: Mon, 26 Apr 2021 14:17:55 +0100 Subject: Solutions for challenge #110 --- challenge-110/roger-bell-west/python/ch-1.py | 10 ++++++++++ challenge-110/roger-bell-west/python/ch-2.py | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100755 challenge-110/roger-bell-west/python/ch-1.py create mode 100755 challenge-110/roger-bell-west/python/ch-2.py (limited to 'challenge-110/roger-bell-west/python') diff --git a/challenge-110/roger-bell-west/python/ch-1.py b/challenge-110/roger-bell-west/python/ch-1.py new file mode 100755 index 0000000000..ff7e397315 --- /dev/null +++ b/challenge-110/roger-bell-west/python/ch-1.py @@ -0,0 +1,10 @@ +#! /usr/bin/python3 + +import fileinput +import re + +pn=re.compile("^ *(\+[0-9]{2}|\([0-9]{2}\)|[0-9]{4}) [0-9]{10} *$") +for line in fileinput.input(): + line=line.rstrip() + if re.match(pn,line): + print(line) diff --git a/challenge-110/roger-bell-west/python/ch-2.py b/challenge-110/roger-bell-west/python/ch-2.py new file mode 100755 index 0000000000..5ee699e520 --- /dev/null +++ b/challenge-110/roger-bell-west/python/ch-2.py @@ -0,0 +1,16 @@ +#! /usr/bin/python + +import fileinput + +a=[] + +for line in fileinput.input(): + line=line.rstrip() + r=line.split(',') + for ci in range(len(r)): + while len(a) < ci+1: + a.append([]) + a[ci].append(r[ci]) + +for r in a: + print (','.join(r)) -- cgit