Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions book/analysis/anagrams.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ def anagram_checking_off(s1, s2):

Here is a possible implementation using this strategy:
"""
from itertools import izip_longest
from itertools import zip_longest


def anagram_sort_and_compare(s1, s2):
for a, b in izip_longest(sorted(s1), sorted(s2)):
for a, b in zip_longest(sorted(s1), sorted(s2)):
if a != b:
return False
return True
Expand Down