TDT4109/Exercise 4 - Inspera/13.py

8 lines
165 B
Python
Raw Permalink Normal View History

2020-10-01 12:05:45 +02:00
import re
def count_letters(string):
try:
assert bool(re.match('^\w+$', string))
return len(string)
except AssertionError:
return -1