mirror of
https://github.com/kennethreitz/dive-into-python3.git
synced 2026-06-05 23:10:17 +00:00
changed alphametics to use set() instead of set comprehensions, which neatly dovetails with my irrational reluctance to explain comprehensions
This commit is contained in:
Regular → Executable
+1
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user