aboutsummaryrefslogtreecommitdiff
path: root/challenge-110/roger-bell-west/python
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-110/roger-bell-west/python')
-rwxr-xr-xchallenge-110/roger-bell-west/python/ch-1.py10
-rwxr-xr-xchallenge-110/roger-bell-west/python/ch-2.py16
2 files changed, 26 insertions, 0 deletions
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))