Skip to content

Commit 21bb833

Browse files
committed
better metavar, consistent regex syntax
1 parent 1c21ca6 commit 21bb833

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

18_gematria/solution.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def get_args():
1414
description='Gematria',
1515
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
1616

17-
parser.add_argument('text', metavar='str', help='Input text or file')
17+
parser.add_argument('text', metavar='text', help='Input text or file')
1818

1919
args = parser.parse_args()
2020

@@ -38,7 +38,7 @@ def main():
3838
def word2num(word):
3939
"""Sum the ordinal values of all the characters"""
4040

41-
return str(sum(map(ord, re.sub('[^a-zA-Z0-9]', '', word))))
41+
return str(sum(map(ord, re.sub('[^A-Za-z0-9]', '', word))))
4242

4343

4444
# --------------------------------------------------

18_gematria/words.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
banana
2+
Apple
3+
Cherry
4+
anchovies
5+
cabbage
6+
Beets

0 commit comments

Comments
 (0)