mirror of
https://github.com/kennethreitz/dive-into-python3.git
synced 2026-06-05 23:10:17 +00:00
docstring fiddling
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user