<jupyter_start><jupyter_text>Check if Two (or phrases) Words are Anagrams<jupyter_code>word = 'word'
word == word
split_word=[w for w in word]
compare=[w for w in word]
compare.sort()
split_word == compare
def is_anagram(string1, string2):
        string1 = [letter for letter in string1]
        string1.sort()
        string2 = [letter for letter in string2]
        string2.sort()
        return string1 == string2
is_anagram('debit card', 'bad credit')
is_anagram('dirty room', 'dormitory')
def is_anagram(word_1, word_2):
    word_1 = [letter for letter in word_1 if letter !=' ']
    word_1.sort()
    word_2 = [letter for letter in word_2 if letter != ' ']
    word_2.sort()
    return word_1 == word_2
is_anagram('dirty room', 'dormitory')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11969111969111969, 'fraction_numerical': 0.02574002574002574, 'mean_word_length': 3.9554140127388533, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '193492', 'license': 'MIT', 'n_tokens_mistral': 273, 'n_tokens_neox': 271, 'n_words': 78, 'path': 'Section 9/9.6-anagrams.ipynb', 'repo_name': 'PacktPublishing/The-Modern-Python-Challenge-v-', 'size': '777'}