From 88b0539e7ebe59ebeab9318960bf86e9aa131211 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Thu, 19 Mar 2020 14:50:37 +0200 Subject: [PATCH] Update is_anagram.md --- snippets/is_anagram.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/is_anagram.md b/snippets/is_anagram.md index a25dd7e03..2f7e31705 100644 --- a/snippets/is_anagram.md +++ b/snippets/is_anagram.md @@ -5,8 +5,8 @@ tags: string,intermediate Checks if a string is an anagram of another string (case-insensitive, ignores spaces, punctuation and special characters). -Filter out non-alphanumeric characters and transform each character to its lowercase version. -Use a `collections.Counter` to count the resulting characters and compare the results. +Use `isalnum()` to filter out non-alphanumeric characters, `lower()` to transform each character to lowercase. +Use `collections.Counter` to count the resulting characters for each string and compare the results. ```py from collections import Counter