changed alphametics to use set() instead of set comprehensions, which neatly dovetails with my irrational reluctance to explain comprehensions

This commit is contained in:
Mark Pilgrim
2009-07-15 09:54:39 -04:00
parent f14715ed37
commit 2193602838
3 changed files with 11 additions and 10 deletions
Regular → Executable
+1 -1
View File
@@ -9,7 +9,7 @@ import itertools
def solve(puzzle):
words = re.findall('[A-Z]+', puzzle.upper())
unique_characters = {c for c in ''.join(words)}
unique_characters = set(''.join(words))
assert len(unique_characters) <= 10
first_letters = {word[0] for word in words}
n = len(first_letters)