diff --git a/examples/alphametics.py b/examples/alphametics.py index 3d5c505..dd64677 100644 --- a/examples/alphametics.py +++ b/examples/alphametics.py @@ -1,13 +1,13 @@ +"""Find solutions to alphametic equations. + +>>> alphametics.solve('SEND + MORE == MONEY') +'9567 + 1085 == 10652' +""" + import re import itertools def solve(puzzle): - '''Find solutions to alphametic equations. - - >>> solve('SEND + MORE == MONEY') - 9567 + 1085 == 10652 - - ''' words = re.findall('[A-Z]+', puzzle) unique_characters = set(''.join(words)) assert len(unique_characters) <= 10